Skip to content

Instantly share code, notes, and snippets.

@michaelsarduino
Created September 30, 2015 12:55
Show Gist options
  • Save michaelsarduino/da09a68907064d0cf0e1 to your computer and use it in GitHub Desktop.
Save michaelsarduino/da09a68907064d0cf0e1 to your computer and use it in GitHub Desktop.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
ESP8266WebServer server(80);
MDNSResponder mdns;
void setup() {
WiFi.softAP("esp8266_ap", "michaelsarduino");
Serial.begin(115200);
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/inline", [](){
server.send(200, "text/plain", "Funktioniert");
});
server.begin();
}
void loop() {
server.handleClient();
mdns.update();
}
void handleRoot() {
server.send(200, "text/html", "<html> <h2>ESP NETWORK</h2> schamlose Eigenwerbung: <b>michaelsarduino.blogspot.de/</b> </html>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment