Guest User

Untitled

a guest
Apr 7th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <ESP8266WiFi.h>
  2. #include <WiFiClient.h>
  3. #include <ESP8266WebServer.h>
  4.  
  5. /* Set these to your desired credentials. */
  6. const char *ssid = "ESPap";
  7. const char *password = "thereisnospoon";
  8.  
  9. ESP8266WebServer server(80);
  10.  
  11. /* Just a little test message.  Go to http://192.168.4.1 in a web browser
  12.  * connected to this access point to see it.
  13.  */
  14. void handleRoot() {
  15.     server.send(200, "text/html", "<h1>You are connected bitch</h1>");
  16. }
  17.  
  18. void setup() {
  19.     delay(1000);
  20.     Serial.begin(115200);
  21.     Serial.println();
  22.     Serial.print("Configuring access point...");
  23.     /* You can remove the password parameter if you want the AP to be open. */
  24.     WiFi.softAP(ssid, password);
  25.  
  26.     IPAddress myIP = WiFi.softAPIP();
  27.     Serial.print("AP IP address: ");
  28.     Serial.println(myIP);
  29.     server.on("/", handleRoot);
  30.     server.begin();
  31.     Serial.println("HTTP server started");
  32. }
  33.  
  34. void loop() {
  35.     server.handleClient();
  36. }
Add Comment
Please, Sign In to add comment