Last active
December 2, 2018 11:48
-
-
Save hector6872/1aef38f33b416e7692a2fc3c58009aec to your computer and use it in GitHub Desktop.
wifi-connect Arduino sketch
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
// + info: https://arduino-esp8266.readthedocs.io/en/2.4.2/esp8266wifi/readme.html | |
#include <ESP8266WiFi.h> | |
const char* SSID = "SSID"; | |
const char* PASSWORD = "PASSWORD"; | |
void setup() { | |
Serial.begin(115200); | |
delay(100); | |
Serial.print("Connecting to: "); | |
Serial.println(SSID); | |
WiFi.mode(WIFI_STA); | |
WiFi.disconnect(); | |
delay(100); | |
WiFi.begin(SSID, PASSWORD); | |
while (WiFi.status() != WL_CONNECTED) { | |
delay(500); | |
Serial.print("."); | |
} | |
Serial.println(""); | |
Serial.println("WiFi connected!"); | |
Serial.print("IP address: "); | |
Serial.println(WiFi.localIP()); | |
} | |
void loop() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment