Blynk.begin locking code up

My project is IoT enabled, but I need it to run regardless of being on WiFi or not.
I am using an ATmega1284p that communicates with esp8266 for WiFi connection.

The problem is: after Blynk.begin, if WiFi credentials & Blynk auth are not right, it gets stuck failing to connect infinitely. I need to prevent this, in case the user isn’t on WiFi they still need the other functionality.
So I need it to just stop trying and move on after 2-3 attempts.

How can I accomplish this? I’m looking through the libraries to see if I could modify it to just quit and move on after a certain time or number of attempts, but haven’t found the right library file yet.

Covered in Connection Management. Stop using Blynk.begin(), use Blynk.config() and Bynk.connect() etc.

Thanks. I couldn’t get Blynk.connect to work as documented in Connection Management, but after finding the header file (I’m using BlynkSimpleShieldEsp8266) I found the shield config function has different inputs. Code now compiles. I will test functionality and update as soon as I get a chance.

in case anyone else has a problem with Blynk.config giving an error when using the ESP8266 shield.
From the header file it is looking for:

void config(ESP8266& esp8266, const char* auth, const char* domain = BLYNK_DEFAULT_DOMAIN, uint16_t port = BLYNK_DEFAULT_PORT)

my ESP8266 variable is named wifi. (from my code where I set that up):
ESP8266 wifi(&EspSerial);

so to use config I just call
Blynk.config(wifi,auth)

the documented implementation, I assume of for standalone/non-shield use, just calls Blynk.config(auth), which gave me error.

I still haven’t tested but that takes care of errors when compiling.

1 Like