Created
May 20, 2017 18:17
-
-
Save DfKimera/4d736cfe06376f946b0750b23fad2484 to your computer and use it in GitHub Desktop.
Testing NodeMCU wi-fi capabilities
This file contains 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 <ESP8266WebServer.h> | |
const char *ssid = "ESPap"; | |
const char *password = "thereisnospoon"; | |
ESP8266WebServer server(80); | |
void handleRoot() { | |
server.send(200, "text/html", "<h1>You are connected</h1>"); | |
} | |
void setup() { | |
delay(1000); | |
Serial.begin(115200); | |
Serial.println(); | |
Serial.print("Configuring access point..."); | |
WiFi.softAP(ssid, password); | |
IPAddress myIP = WiFi.softAPIP(); | |
Serial.print("AP IP address: "); | |
Serial.println(myIP); | |
server.on("/", handleRoot); | |
server.begin(); | |
Serial.println("HTTP server started"); | |
} | |
void loop() { | |
server.handleClient(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment