Added WiFi connection

This commit is contained in:
Blue Fox 2022-08-21 17:28:52 +02:00
parent 3824999721
commit 0b7c66a684
2 changed files with 20 additions and 0 deletions

View File

@ -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();
}

15
wifi.ino Normal file
View File

@ -0,0 +1,15 @@
#include <WiFi.h>
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;
}