15 lines
488 B
Arduino
15 lines
488 B
Arduino
|
#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;
|
||
|
}
|