#include <WiFi.h>
#include <ESPAsyncWebServer.h>
ESPAsyncWebServer Server(80);
void notFound(AsyncWebServerRequest * request)
{
request->send(404,"text/plain","Not Found");
}
void setup() {
Serial.begin(115200);
Serial.print("Connecting to WiFi");
WiFi.softAP("Wokwi-GUEST","");
while (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println(" Connected!");
Serial.println(WiFi.softAPIP());
Server.on("/" , [](AsyncWebServerRequest * request)
{
String message = "hello world";
request->send(200,"text/plain",message);
});
Server.onNotFound(notFound);
Server.begin();
}
void loop() {
delay(100); // TODO: Build something amazing!
}Loading
esp32-devkit-c-v4
esp32-devkit-c-v4