losungepaper/wifi.ino

15 lines
576 B
Arduino
Raw Normal View History

2022-08-21 15:28:52 +00:00
#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("[WiFi] Connecting to WiFi...");
2022-08-21 15:28:52 +00:00
WiFi.begin(wiFiSSID, wiFiPSK);
delay(10000); // pause the program 5 secs to give time for connection
if(WiFi.status() != WL_CONNECTED) { Serial.printf("[WiFi] Failed connecting to WiFi \"%s\".", wiFiSSID); return; }
Serial.printf("[WiFi] Connected to WiFi \"%s\", got IP-Adress ", wiFiSSID);
2022-08-21 15:28:52 +00:00
Serial.println(WiFi.localIP());
return;
}