diff --git a/platformio.ini b/platformio.ini index dd417b9..dc5aea6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -13,8 +13,10 @@ platform = espressif32 board = m5stack-fire framework = arduino lib_deps = + https://github.com/me-no-dev/ESPAsyncWebServer.git m5stack/M5EPD @ ^0.1.1 bblanchon/ArduinoJson @ ^6.17.3 + ayushsharma82/AsyncElegantOTA @ ^2.2.7 upload_speed = 2000000 monitor_speed = 115200 board_build.partitions = default_16MB.csv diff --git a/src/main.cpp b/src/main.cpp index f8f0251..f412044 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,38 @@ #include +#include +#include +#include + +const char* ssid = "REPLACE_WITH_YOUR_SSID"; +const char* password = "REPLACE_WITH_YOUR_PASSWORD"; + +AsyncWebServer server(80); + +void setup(void) { + Serial.begin(115200); + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + Serial.println(""); + + // Wait for connection + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println(""); + Serial.print("Connected to "); + Serial.println(ssid); + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + + server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { + request->send(200, "text/plain", "Hi! I am ESP32."); + }); + + AsyncElegantOTA.begin(&server); // Start ElegantOTA + server.begin(); + Serial.println("HTTP server started"); -void setup() -{ disableCore0WDT(); M5.begin(); M5.TP.SetRotation(90);