#include #include const char* ssid = "arduino"; const char* password = "11111111"; ESP8266WebServer server(80); const int ledPin = 5; // GPIO5 (D1) void handleRoot() { server.send(200, "text/html", "

LED is OFF

"); } void handleLEDOn() { digitalWrite(ledPin, HIGH); server.send(200, "text/html", "

LED is ON

"); } void handleLEDOff() { digitalWrite(ledPin, LOW); server.send(200, "text/html", "

LED is OFF

"); } void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); WiFi.begin(ssid, password); Serial.println("Connecting to WiFi..."); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.print("."); } Serial.println(); Serial.print("Connected to WiFi. IP address: "); Serial.println(WiFi.localIP()); server.on("/", handleRoot); server.on("/ledOn", handleLEDOn); server.on("/ledOff", handleLEDOff); server.begin(); Serial.println("HTTP server started"); } void loop() { server.handleClient(); }