Esp 01 connect to 2 WIFI signals

i use this code to control my light bulbs using blynk and ESP01s



#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "AUTH key";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Name";
char pass[] = "pw";

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
}

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

now i want to add a 3 router details for this. for connect the strong WIFI signal or available one. in my home have 3 wifi signals

how i add all details for this code. thank you

Please edit your post and add triple backticks at the beginning and end of code, so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

Thank you done

Do you already have code that is working without BLYNK? Or are you looking for someone to provide it?

I know that this has been discussed/asked before so maybe if you search around this forum you may find something.

Otherwise post what you have tried, and what errors are occurring, then maybe someone here could try to provide some feedback/advice.

If you are hoping someone will just write it for you and post it here, I wouldn’t hold my breath as it may be a while, and probably won’t happen.

1 Like

The simple solution is to change your WiFi setup so that all the SSIDs and passwords are the same.

Pete.

1 Like
//============================    Connect_1
   if (Blynk.connect() == false) {
     WiFi.begin  (ssid, pass);
     Blynk.config (auth);
     Blynk.connect(15000);
     while (WiFi.waitForConnectResult() != WL_CONNECTED) {
       break;
       }
       
//===============================    Connect_2
   if (Blynk.connect() == false) {
     WiFi.begin  (ssid_1, pass_1);
     Blynk.config (auth);
     Blynk.connect(15000);
     while (WiFi.waitForConnectResult() != WL_CONNECTED) {
       break;
       }

//===============================    Connect_3
  if (Blynk.connect() == false) {
     WiFi.begin  (ssid_2, pass_2);
     Blynk.config (auth);
     Blynk.connect(15000);
     while (WiFi.waitForConnectResult() != WL_CONNECTED) {
       ESP.restart();
       }
        }
      }
    }

1 Like

Please edit your post and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.