esp32-ch390-web-server-local.ino
Creating a simple HTML web server hosted on the ESP32, accessible only via the CH390 wired Ethernet connection.
The ESP32 must have its CH390 Ethernet interface configured and active before calling server.begin(). Open a browser on a PC on the same network and type the ESP32's IP to view the page. No WiFi connection is required.
esp32-ch390-web-server-local.ino
#include "WebServer.h"
#include "esp_netif.h"
WebServer server(80);
void handleRoot() {
String html = "<h1>Olimex CH390 Web Server</h1>";
html += "<p>Status: Ethernet Connected via CH390</p>";
html += "<p>Uptime: " + String(millis()/1000) + "s</p>";
server.send(200, "text/html", html);
}
void setup() {
Serial.begin(115200);
// Initialisation réseau Ethernet (Code simplifié, voir init CH390)
// esp_eth_start(eth_handle);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP Server started on port 80");
}
void loop() {
server.handleClient();
}