wifi_web_dashboard.ino
Configure une connexion WiFi et sert une page web simple.
Modifiez les identifiants WiFi dans le code. Ouvrez l'adresse IP affichée sur le moniteur série dans un navigateur.
wifi_web_dashboard.ino
#include <WiFi.h>
#include <WebServer.h>
const char* ssid = "VOTRE_WIFI";
const char* password = "VOTRE_MOT_DE_PASSE";
WebServer server(80);
void handleRoot() {
String html = "<!DOCTYPE html><html><body>";
html += "<h1>M5Stack PaperDIY</h1>";
html += "<p>ESP32-S3 Web Server</p>";
html += "<p>IP: " + WiFi.localIP().toString() + "</p>";
html += "</body></html>";
server.send(200, "text/html", html);
}
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nConnecté");
server.on("/", handleRoot);
server.begin();
}
void loop() {
server.handleClient();
}