#include const char* ssid ="Orange_Swiatlowod_0960"; // Tu wpisz nazwę swojego wifi const char* password = "JL27QYVJRQR6"; // Tu wpisz hasło do swojego wifi WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); // 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() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data int timewate = 0; while(!client.available()){ delay(1); timewate = timewate +1; if(timewate>1800) { Serial.println(">>> Client Timeout !"); client.stop(); return; } } // Read the first line of the request String request = client.readStringUntil('\r'); client.flush(); // Match the request int value = LOW; if (request.indexOf("/b0") != -1) { Serial.println("n"); value = HIGH; } if (request.indexOf("/b1") != -1) { Serial.println("w"); value = LOW; } if (request.indexOf("/b2") != -1) { Serial.println("s"); value = HIGH; } if (request.indexOf("/b3") != -1) { Serial.println("e"); value = LOW; } // Return the response client.println(""); client.println(""); client.println(""); // do not forget this one client.println("Sterowanie robotem z pomocą modułu ESP"); client.println("

Połączenie z Arduino


Przyciski pozwalają na sterowanie robotem

"); client.println("
Up

"); client.println("
Left
Down
Right
"); delay(1); }