#include const char* ssid = "*********";//type your ssid const char* password = "************";//type your password int x=0 ; int ledPin = 2; // GPIO2 of ESP8266 WiFiServer server(80); void setup() { ESP.wdtDisable(); Serial.begin(115200); delay(600); pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); // Connect to WiFi network Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); // Start the server server.begin(); Serial.println("Server started"); // Print the IP address Serial.print("Use this URL to connect: "); Serial.print("http://"); Serial.print(WiFi.localIP()); Serial.println("/"); } void loop() { ESP.wdtDisable(); // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data while(!client.available()){ delay(1); } // Read the first line of the request String request = client.readStringUntil('\r'); client.flush(); // Match the request int value1 = LOW; int value2 ; int value3= LOW; if ((request.indexOf("/100") != -1)||(request.indexOf("/101") != -1) ||(request.indexOf("/110") != -1) ||(request.indexOf("/111") != -1)) { digitalWrite(ledPin, LOW); value3 = HIGH; value2 = LOW; value1 = LOW; Serial.println('a'); } else if ((request.indexOf("/000") != -1)||(request.indexOf("/001") != -1) ||(request.indexOf("/010") != -1) ||(request.indexOf("/011") != -1)) { Serial.println('b'); } if ((request.indexOf("/110") != -1)||(request.indexOf("/011") != -1) ||(request.indexOf("/010") != -1) ||(request.indexOf("/111") != -1)) { digitalWrite(ledPin, LOW); value3 = HIGH; value2 = LOW; value1 = LOW; Serial.println('c'); } else if ((request.indexOf("/100") != -1)||(request.indexOf("/001") != -1) ||(request.indexOf("/000") != -1) ||(request.indexOf("/101") != -1)) { Serial.println('d'); } if ((request.indexOf("/001") != -1)||(request.indexOf("/101") != -1) ||(request.indexOf("/011") != -1) ||(request.indexOf("/111") != -1)) { digitalWrite(ledPin, LOW); value3 = HIGH; value2 = LOW; value1 = LOW; Serial.println('e'); } else if ((request.indexOf("/000") != -1)||(request.indexOf("/100") != -1) ||(request.indexOf("/010") != -1) ||(request.indexOf("/110") != -1)) { Serial.println('f'); } // Set ledPin according to the request //digitalWrite(ledPin, value); // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println(""); client.println(""); client.println ("***************************************
"); client.println (" ***********"); client.println (" Mohamed Ashraf "); client.println (" **********
"); client.println (" ************ "); client.println (" 01097003433 "); client.println (" ************
"); client.println("
"); client.println("********** your device is"); if(value1 == HIGH) { client.print("Stopped**********
"); } if(value3 == HIGH ) { client.print("working**********
"); } client.println("
"); client.println("
"); client.println("**********STOP YOUR DEVICE *********
"); client.println("
"); client.println("**********START YOUR DEVICE *******
"); client.println("***************************************
"); client.println(""); delay(1); }