Added base functionality
This commit is contained in:
parent
0e598c5602
commit
852092e998
31
WEBSERVER_LED_CONTROL.ino
Normal file
31
WEBSERVER_LED_CONTROL.ino
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#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");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user