What happens when the router is turned off?!

When I turn on the NodeMCU ESP8266, and it tries to log in to the router and the router is off or not close enough, the routine is stuck in that function and nothing else happens!!!
I already tried some things that I saw, through google, but it didn’t work!!

What I would really like to be able to do is the following:

I have 3 possibilities of connections, at my house, at my father’s house and at my sister’s house…

I wish, to go to any of these places and the NodeMCU connects with the router where it is!!

As I said before, I already tried some things I saw on google…
but I realized that blink has been around for a long time and most of the examples I find are still for the old app, that I couldn’t make an account… I just managed to make an account, on the new Blynk!

this is the place of the code, that the software stay stoped:

void setup()


  Blynk.begin(auth, ssid, pass);  // at this point it does not come back when it does not connect to the router

  // Initialize sensor
  while (!particleSensor.begin(Wire, I2C_SPEED_FAST))

Maybe if you share details of what you’ve tried and the results you’ve obtained, then the feedback you get would be more meaningful.

Yes, that’s what happens when you use Blynk.begin, it’s a blocking function. You won’t receive the results you are looking for unless you manually establish the WiFi connection yourself and use Blynk.config and Blynk.connect.

Getting the WiFi connection established, by trying to connect to SSID A, followed by SSID B if that fails, followed by SSID C if that fails is a simple non-Blynk coding task.
Personally, I’d avoid trying to use libraries such as Multi WiFi, as these just add unnecessary complexity.

Other than using blynk.cloud rather than blynk-cloud.com In your Blynk.config command, and adding the Template ID etc at the top of your sketch, there should be no major differences.


my problem is already solved:
I followed your suggestion about connecting to the network first and analyzing and then interacting with Blink…
while researching the ESP8266 WiFi documentation, I found that it is possible to do multiple logins…
In this way, I chose to log in to the three networks at the same time and in the one that is present, there will be a network available.

I’m only sorry for not having developed the original problem, to have left here, more material for future help to other users! :frowning:

thank you so much by U help! :wink:

1 Like