diff --git a/src/main.cpp b/src/main.cpp index 1b1c30f..3641542 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,24 +5,34 @@ */ #include +#include +#include -// Set LED_BUILTIN if it is not defined by Arduino framework -// #define LED_BUILTIN 2 +WiFiMulti wifiMulti; void setup() { + Serial.begin(115200); + // initialize LED digital pin as an output. pinMode(LED_BUILTIN, OUTPUT); + + wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); + wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2); + + Serial.println("Connecting Wifi..."); + if(wifiMulti.run() == WL_CONNECTED) { + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + } } void loop() { - // turn the LED on (HIGH is the voltage level) - digitalWrite(LED_BUILTIN, HIGH); - // wait for a second - delay(1000); - // turn the LED off by making the voltage LOW - digitalWrite(LED_BUILTIN, LOW); - // wait for a second - delay(1000); + if(wifiMulti.run() != WL_CONNECTED) { + Serial.println("WiFi not connected!"); + delay(1000); + } }