Add an OTA update webserver

This commit is contained in:
Correl Roush 2023-01-19 22:41:50 -05:00
parent 5e7ed723d8
commit 4d828e874e
2 changed files with 35 additions and 2 deletions

View file

@ -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

View file

@ -1,7 +1,38 @@
#include <M5EPD.h>
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>
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);