#include <WiFi.h>
#include <WebServer.h>
const char *ssid = "Wokwi-GUEST";
const char *pass = "";
#define WIFI_CHANNEL 6
WebServer myserver(80);
void setup() {
// put your setup code here, to run once:
WiFi.begin(ssid,pass);
while(WiFi.status() != WL_CONNECTED);
myserver.on("/", handle_connect);
myserver.on("/hello", handle_hello);
myserver.begin();
}
void loop() {
myserver.handleClient();
}
String html = "<p style=\"text-align: center;\">ESP32 WEBSERVER</p> <p style=\"text-align: center;\">STA-MODE</p> <p style=\"text-align: center;\">Lap trinh giao tiep thiet bi</p> <p></p>";
void handle_connect() {
Serial.println("HTTP Request");
myserver.send(200, "text/html", html);
}
void handle_hello() {
Serial.println("HTTP Request");
myserver.send(200, "text/plain", "Hello Ruok!");
}