Check WiFi connection

Noob Question:
Is there a way to check via code wether WiFi is connected at the moment? Because sometimes my esp32 just goes offline with no reason. So the code should look something like this:

if "WiFiDisconnected" "ConnetToWiFi"

Any ideas how to do that?

Not this forum :slight_smile: Sure you can, but you need to study a bit the Arduino ESP core. I don’t know the specific ESP32 differences, but here you can read about ESP8266. Anyway mostly should be the same for ESP32

1 Like
if (WiFi.status() != WL_CONNECTED) {
    Serial.println("WiFi connection LOST");

autoConnect is true by default