I have problem with send SSI script to Wago PLC.
When I use the command from a web browser: http://192.168.5.2/WRITEPI?ADR1=MW23&VA ... FORMAT1=%x the address in the PLC (MW23) is set to 1, but not from Esp32.
Can I ask for help?
My code:
Code: Select all
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "Router1";
const char* password = "ppp";
void setup() {
Serial.begin(115200);
delay(4000);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
Serial.println("Connected to the WiFi network");
}
void loop() {
if ((WiFi.status() == WL_CONNECTED)) { //Check the current connection status
HTTPClient http;
http.begin("http://192.168.5.2/WRITEPI?ADR1=MW23&VALUE1=1&FORMAT1=%x"); //Specify the URL
int httpCode = http.GET(); //Make the request
if (httpCode > 0) { //Check for the returning code
String payload = http.getString();
Serial.println(httpCode);
Serial.println(payload);
}
else {
Serial.println("Error on HTTP request");
}
http.end(); //Free the resources
}
delay(10000);
}