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.