Hardware:
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.println(analogRead(sens1));
Serial.print("Sensor 2 analog value = ");
Serial.println(analogRead(sens2));
//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) {
Blynk.run();
MY_timer.run();
}
}
```cpp