Running code normally even if blynk is not connected

1- ESP-01 as a wifi module
2- Arduino Uno

I want my code to run normally by bypassing the Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass); function if no wifi network or internet or a wifi module is detected! It seems that if there is no registered wifi network code gets stuck there forever. I want to bypass this function after a specific amount of time and to recheck for connection later!

I searched a lot and couldn’t find a useful solution for my case.

This is my blynk implementation in void setup() function

void setup()
     Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);

void loop()

  Serial.print("Sensor 1 analog value = ");
  Serial.print("Sensor 2 analog value = ");

  //Override the Automated system
  if (relay1_state == 1) {
    digitalWrite(relay1, LOW);  //Turn ON Relay

  else {
    //Start Watering (Higher Reading = Dry Soil)
    if (analogRead(sens1) > 700) {
      digitalWrite(relay1, LOW);

    //Stop Watering
    if (analogRead(sens1) <= 700) {
      digitalWrite(relay1, HIGH);
  }  //End else

  //Override the Automated system
  if (relay2_state == 1) {
    digitalWrite(relay2, LOW);  //Turn ON Relay

  else {
    if (analogRead(sens2) > 700) {
      digitalWrite(relay2, LOW);

    if (analogRead(sens2) <= 700) {
      digitalWrite(relay2, HIGH);
  if (Blynk.connected() == true) {;;


I dont think its possible using your hardware setup.

You can do it with an ESP8266 or ESP32 based board, by managing your WiFi connection process manually and using Blynk.config() and Blynk.connect instead of Blynk.begin(), but I don’t think that’s possible when using BlynkSimpleShieldEsp8266.h

Also, your void loop structure won’t work with Blynk.

Is there any reason why you are using the Uno/ESP-01 combination instead of a NodeMCU or ESP32 ?


Can I do that using another library? What is the library that should be used?

This is just a small part of the code! Nevermind, I will add the entire Code if needed

It is mandatory for this project, unfortunately!

If you’re using an ESP-01 as a WiFi modem for a Uno then you have to use the BlynkSimpleShieldEsp8266.h library. This is a very primitive library which translates a limited set of WiFi commands into AT commands to allow communication with the ESP-01 in AT modem mode.

If your full code has even more clutter in the void loop then it’s even less suitable for use with Blynk.
You should read this…

Then I think you’re out of luck.


1 Like