Ciao comincia eventualmente a prendere spunto da:
( i moduli ESP8266 non sono cosi diversi )
Ti invio anche il codice in C da inviare tramite l'ID di arduino. Provato e funziona bene:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
//#include <WiFi.h>
#include <ESP8266mDNS.h>
const char* ssid = "Massimo's Galaxy A52s 5G";
const char* pass = "massimo9911";
//int IDxx;
//char IDxx;
ESP8266WebServer server(80);
//IPAddress local_IP(192,168,45,122);
void setup(void) {
pinMode(2, OUTPUT);
Serial.begin(115200);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED){
delay(500);
Serial.print("A");
}
Serial.println(WiFi.localIP());
if (MDNS.begin("esp8266")){
Serial.println("MDNS responder started ");
Serial.print("Local IP ");
Serial.println(WiFi.localIP());
Serial.print("SubnetMask ");
Serial.println(WiFi.subnetMask());
Serial.print("GatewayIP ");
Serial.println(WiFi.gatewayIP());
Serial.print("DNS1 ");
Serial.println(WiFi.dnsIP(0));
Serial.print("DNS2 ");
Serial.println(WiFi.dnsIP(1));
}
server.on("/on", ledon);
server.on("/off", ledoff);
server.begin();
}
void loop(void) {
server.handleClient();
MDNS.update();
}
void ledon(){
digitalWrite(2, HIGH);
server.send(200, "text/plain", "led on");
//char IDxx = WiFi.localIP();
//server.send(200, IDxx);
}
void ledoff(){
digitalWrite(2, LOW);
server.send(200, "text/plain", "led off ");
}