diff --git a/losungepaper.ino b/losungepaper.ino index 68d642d..c0dcde7 100755 --- a/losungepaper.ino +++ b/losungepaper.ino @@ -7,6 +7,10 @@ Epd epd; +// WiFi +char wiFiSSID[] = "SSID"; // SSID of your network +char wiFiPSK[] = "PRE-SHARED KEY"; //password of your WPA Network + // style of the frame shown sFONT TITLE_FONT = Font20; char TITLE_TEXT[] = "Losung heute"; @@ -34,4 +38,5 @@ void setup() { } void loop() { + connectWiFi(); } diff --git a/wifi.ino b/wifi.ino new file mode 100644 index 0000000..f838e31 --- /dev/null +++ b/wifi.ino @@ -0,0 +1,15 @@ +#include + +void connectWiFi() { // connect to the wifi with the above defined credentials + if(WiFi.status() == WL_CONNECTED) { return; } // return if not connected + + Serial.println("Connecting to WiFi..."); + + WiFi.begin(wiFiSSID, wiFiPSK); + delay(5000); // pause the program 5 secs to give time for connection + if(WiFi.status() != WL_CONNECTED) { return; } + Serial.printf("Connected to WiFi %s, got IP-Adress ", wiFiSSID); + Serial.println(WiFi.localIP()); + + return; +} \ No newline at end of file