esp32-ch390-web-server-local.ino

Olimex UEXT-CH390: SPI to Ethernet 10/100 Mbps Module for Microcontrollers · File : esp32-ch390-web-server-local.ino · Language : C++ · Use case : Héberger un serveur web HTTP minimaliste sur l'ESP32 accessible via le réseau filaire CH390.

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();
}

← Back to the board