splitbasicotantpserverdebugwebserial
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| splitbasicotantpserverdebugwebserial [2025/03/01 00:59] – created jwan | splitbasicotantpserverdebugwebserial [2025/10/10 10:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 41: | Line 41: | ||
| const char* ssid = " | const char* ssid = " | ||
| const char* password = " | const char* password = " | ||
| + | const char* hostname = " | ||
| + | String IPaddr; | ||
| + | |||
| // Function to initialize WiFi | // Function to initialize WiFi | ||
| void wifiInit() { | void wifiInit() { | ||
| + | WiFi.hostname(hostname); | ||
| WiFi.begin(ssid, | WiFi.begin(ssid, | ||
| while (WiFi.status() != WL_CONNECTED) { | while (WiFi.status() != WL_CONNECTED) { | ||
| delay(500); | delay(500); | ||
| - | | + | |
| } | } | ||
| - | | + | |
| - | | + | debugln(" |
| - | | + | |
| + | | ||
| } | } | ||
| + | |||
| + | #endif | ||
| #endif | #endif | ||
| Line 119: | Line 126: | ||
| </ | </ | ||
| )rawliteral"; | )rawliteral"; | ||
| + | |||
| + | void handleRoot(AsyncWebServerRequest *request) { | ||
| + | String message = "< | ||
| + | message += "< | ||
| + | message += " | ||
| + | message += "IP Address: " + IPaddr + "< | ||
| + | message += " | ||
| + | message += "</ | ||
| + | request-> | ||
| + | } | ||
| // Function to initialize the web server | // Function to initialize the web server | ||
| void webServerInit() { | void webServerInit() { | ||
| // Route for root / web page | // Route for root / web page | ||
| - | server.on("/", | + | server.on("/ |
| + | server.on("/ | ||
| request-> | request-> | ||
| }); | }); | ||
| Line 130: | Line 148: | ||
| events.onConnect([](AsyncEventSourceClient *client){ | events.onConnect([](AsyncEventSourceClient *client){ | ||
| if(client-> | if(client-> | ||
| - | | + | |
| } | } | ||
| client-> | client-> | ||
| Line 154: | Line 172: | ||
| // Declare and define NTP objects | // Declare and define NTP objects | ||
| WiFiUDP ntpUDP; | WiFiUDP ntpUDP; | ||
| - | NTPClient timeClient(ntpUDP, | + | NTPClient timeClient(ntpUDP, |
| // Function to initialize NTP | // Function to initialize NTP | ||
splitbasicotantpserverdebugwebserial.1740790792.txt.gz · Last modified: (external edit)
