/* Create a WiFi access point and provide a web server on it. */ #include #include "./DNSServer.h" // Patched lib #include const byte DNS_PORT = 53; // Capture DNS requests on port 53 IPAddress apIP(10, 10, 10, 1); // Private network for server DNSServer dnsServer; // Create the DNS object ESP8266WebServer webServer(80); // HTTP server String responseHTML = "" "" "" "" "" "Internet of Bottles" "" "" "

I'm just a stupid bottle with WiFi.

" "" ""; void setup() { // turn the LED on (HIGH is the voltage level) pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, HIGH); // configure access point WiFi.mode(WIFI_AP); WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); WiFi.softAP("IoT --- Free WiFi"); // WiFi name // if DNSServer is started with "*" for domain name, it will reply with // provided IP to all DNS request dnsServer.start(DNS_PORT, "*", apIP); // replay to all requests with same HTML webServer.onNotFound([]() { webServer.send(200, "text/html", responseHTML); }); webServer.begin(); } void loop() { dnsServer.processNextRequest(); webServer.handleClient(); }