losungepaper/wifi.ino

15 lines
576 B
C++
Executable File

#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...");
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);
Serial.println(WiFi.localIP());
return;
}