mirror of
https://github.com/pangodream/ESP2SOTA.git
synced 2025-12-24 22:39:21 +01:00
44 lines
876 B
C++
44 lines
876 B
C++
#include <WiFi.h>
|
|
#include <WebServer.h>
|
|
/* INCLUDE ESP2SOTA LIBRARY */
|
|
#include <ESP2SOTA.h>
|
|
|
|
const char* ssid = "entelequia";
|
|
const char* password = "Mafy-13572468+abc";
|
|
|
|
WebServer server(80);
|
|
|
|
void setup(void) {
|
|
Serial.begin(115200);
|
|
|
|
WiFi.begin(ssid, password);
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
delay(500);
|
|
Serial.print(".");
|
|
}
|
|
Serial.println("");
|
|
Serial.println("WiFi connected");
|
|
Serial.println("IP address: ");
|
|
Serial.println(WiFi.localIP());
|
|
|
|
/* SETUP YOR WEB OWN ENTRY POINTS */
|
|
server.on("/myurl", HTTP_GET, []() {
|
|
server.sendHeader("Connection", "close");
|
|
server.send(200, "text/plain", "Hello there!");
|
|
});
|
|
|
|
/* INITIALIZE ESP2SOTA LIBRARY */
|
|
ESP2SOTA.begin(&server);
|
|
server.begin();
|
|
}
|
|
|
|
void loop(void) {
|
|
/* HANDLE UPDATE REQUESTS */
|
|
server.handleClient();
|
|
|
|
/* YOUR LOOP CODE HERE */
|
|
|
|
|
|
|
|
delay(5);
|
|
} |