From 23621f4a5ee74c3e9452f0878e1247e3455b30ca Mon Sep 17 00:00:00 2001 From: Leonie <135235065+DenialOfIntelligence@users.noreply.github.com> Date: Fri, 29 Sep 2023 18:38:23 +0200 Subject: [PATCH] Improve simple_web --- simple_web/simple_web.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/simple_web/simple_web.ino b/simple_web/simple_web.ino index dffb4f8..e80968d 100644 --- a/simple_web/simple_web.ino +++ b/simple_web/simple_web.ino @@ -18,7 +18,7 @@ AsyncWebServer server(80); const char* ssid = "*******"; -const char* password = "*******"; +const char* password = "********"; const char* PARAM_MESSAGE = "message"; @@ -32,24 +32,24 @@ void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); - if (WiFi.waitForConnectResult() != WL_CONNECTED) { - Serial.printf("WiFi Failed!\n"); - return; - } - + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println("Connected"); Serial.print("IP Address: "); Serial.println(WiFi.localIP()); server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/html", "Turn the LED ONTurn the LED OFF"); + request->send(200, "text/html", " "); }); server.on("/on", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/html", "Turn the LED ONTurn the LED OFF"); digitalWrite(LED_BUILTIN, HIGH); + request->send(200, "text/plain", "Was there ever anything here?"); }); server.on("/off", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send(200, "text/html", "Turn the LED ONTurn the LED OFF"); digitalWrite(LED_BUILTIN, LOW); + request->send(200, "text/plain", "Was there ever anything here?"); }); // Send a GET request to /get?message=