Last active
April 24, 2019 17:06
-
-
Save huhn511/1e097be41765a9e84e1f2b6b36e10476 to your computer and use it in GitHub Desktop.
ESP8266 connec to wlan
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> | |
const char* ssid="<YOUR SSID>"; | |
const char* password="<YOUR PASSWORD>"; | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(LED_BUILTIN, OUTPUT); | |
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on (Note that LOW is the voltage level | |
Serial.begin(115200); | |
Serial.println(); | |
Serial.print("Wifi connection to "); | |
Serial.println(ssid); | |
WiFi.begin(ssid, password); | |
Serial.println(); | |
Serial.print("Connecting"); | |
while(WiFi.status() != WL_CONNECTED ) { | |
delay(500); | |
Serial.print("."); | |
} | |
digitalWrite(LED_BUILTIN, HIGH); | |
Serial.println(); | |
Serial.println("WiFi connected!"); | |
Serial.print("ESP IP Address:"); | |
Serial.println(WiFi.localIP()); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment