32 lines
603 B
C++
32 lines
603 B
C++
#include <ESP8266WiFi.h>
|
|
#include <WiFiClient.h>
|
|
#include <ESP8266WebServer.h>
|
|
#include <ESP8266mDNS.h>
|
|
#include <WiFiManager.h>
|
|
|
|
ESP8266WebServer server(80);
|
|
|
|
void setup() {
|
|
|
|
// Initialize Wifi, start AP if no saved Wifi in range
|
|
WiFiManager wifiManager;
|
|
wifiManager.autoConnect("WEMOS D1 mini pro");
|
|
|
|
server.on("/", handleRoot);
|
|
server.onNotFound(handleNotFound);
|
|
|
|
server.begin();
|
|
}
|
|
|
|
void loop() {
|
|
server.handleClient();
|
|
}
|
|
|
|
void handleRoot() {
|
|
server.send(200, "text/plain", "hello from esp8266!");
|
|
}
|
|
|
|
void handleNotFound() {
|
|
server.send(404, "text/plain", "404 File Not Found");
|
|
}
|