Created
October 9, 2015 12:36
-
-
Save michaelsarduino/87e2a8861cf0b834776a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <WiFiClient.h> | |
#include <WiFiServer.h> | |
#include <WiFiUdp.h> | |
#include <ESP8266mDNS.h> | |
#include <ESP8266WebServer.h> | |
ESP8266WebServer server(80); | |
const char* ssid = "******************"; //Name des bestehenden Wlan Netzwerks | |
const char* password = "**************"; //Passwort des bestehenden Wlan Netzwerks | |
MDNSResponder mdns; | |
void setup() { | |
Serial.begin(115200); | |
WiFi.softAP("esp8266_ap", "michaelsarduino"); //Name und Passwort des neuen Wlan Netzwerks | |
WiFi.begin(ssid, password); //Verbinden mit Wlan Router | |
Serial.println("Verbindung wird aufgebaut:"); | |
while (WiFi.status() != WL_CONNECTED) { | |
Serial.print("."); | |
delay(500); | |
} | |
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(); //Starten des Webservers | |
} | |
void loop() { | |
server.handleClient(); | |
mdns.update(); | |
} | |
void handleRoot() { | |
server.send(200, "text/html", "<html> <h3>ESP NETWORK</h3> schamlose Eigenwerbung: <b>michaelsarduino.blogspot.de/</b> </html>"); //hier HTML Code einfügen | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment