diff --git a/losungepaper.ino b/losungepaper.ino index 372348d..409ca02 100755 --- a/losungepaper.ino +++ b/losungepaper.ino @@ -18,6 +18,9 @@ const String ntpServer = "pool.ntp.org"; // address of ntp server; may also be const long gmtOffset_sec = 3600; // for localization (gmt = greenwich mean time); in germany: 3600 const int daylightOffset_sec = 3600; // for daylight saving +// onboard LED +const int LED_ON_WIFI_ERROR = 2; + // style of the frame shown sFONT TITLE_FONT = Font20; char TITLE_TEXT[] = "Losung heute"; diff --git a/wifi.ino b/wifi.ino index 96de09c..e250712 100755 --- a/wifi.ino +++ b/wifi.ino @@ -1,6 +1,18 @@ #include #include "time.h" +void blinkLED(int pin) { + pinMode(pin, OUTPUT); + delay(500); + digitalWrite(pin,HIGH); + delay(500); + digitalWrite(pin,LOW); + delay(500); + digitalWrite(pin,HIGH); + delay(500); + digitalWrite(pin,LOW); +} + bool connectWiFi() { // connect to the wifi with the above defined credentials if(WiFi.status() == WL_CONNECTED) { return true; } // return if not connected @@ -11,9 +23,11 @@ bool connectWiFi() { // connect to the wifi with the above defined credentials delay(2000); Serial.printf("."); if(WiFi.status() == WL_NO_SSID_AVAIL) { Serial.println("\n[WiFi] Failed to connect to WiFi. Reason: WL_NO_SSID_AVAIL"); + blinkLED(LED_ON_WIFI_ERROR); return false; } else if(WiFi.status() == WL_CONNECT_FAILED) { Serial.println("\n[WiFi] Failed to connect to WiFi. Reason: WL_CONNECT_FAILED"); + blinkLED(LED_ON_WIFI_ERROR); return false; } }