BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Try to connect to wifi after disconnection

i have a very simple code which im using to control a relay module using my esp32.

#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "-------------------------------";

char ssid[] = "-----------";
char pass[] = "----------------";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

but when i’m running this code and my wifi gets disconnected or it turns off for some reason and turns on again the esp32 is not automatically reconnecting to the wifi. How to get over this issue and program my esp32 such that whenever it disconnects from my wifi or blynk servers it should try to reconnect for an unlimited period of time i.e, it should try to connect to the wifi till its connected to the internet.pleasee help someone?

Pete.