How to establish a Wi-Fi connection on the ESP32 without the need for restarting it?

59 Views Asked by At

Code of ESP32 for Blynk and reconnection with the Wi-Fi:

void setup() {
  Serial.begin(115200);

  Blynk.begin(auth,ssid,pass);
}

void loop() {
    if (Blynk.connected()) { 
        Blynk.run();
        Blynk.syncAll();
    } else {
        Blynk.disconnect();
        delay(500);
        Blynk.begin(auth,ssid,pass);
    }
}

Everything is correct but the Wi-Fi is not connected on the first try, it requires restarting it and then ESP32 connects instantly.

I tried all permutations and combinations of Wi-Fi and ESP32 but only restarting my Wi-Fi is required to connect them.

0

There are 0 best solutions below