Change auth, ssid and pass from BLYNK terminal for NANO+ESP-01 project

@longdv it is possible without a physical button but much easier if you have one, that is why we don’t recommend the very limited ESP01’s.

Fortunately we recently posted a sketch extract that should work for you. Basically IF not connected with first set of credentials try another connection. The code extract is part of theSmartBlynkie™© ioT Game thread but reproduced here as:

 Serial.print("WiFi connected with IP address: ");
  Serial.println(WiFi.localIP());  
  if(pinSda > 1){  // this is just a test to say if pinSda in WiFi Manager is set to > 1
    // sketch will try a few connections, in the order they were put in WiFi Manager   
    Blynk.config(blynk_token1, blynk_server1); // Blynk Cloud Server
    int mytimeout = millis() / 1000;
    while (Blynk.connect() == false) { // try to connect to server for 10 seconds
      if((millis() / 1000) > mytimeout + 8){ // try local server if not connected in 9s
        // assume local server success if Blynk cloud failed
        strcpy(connectionStatus, "Connected to local server"); 
                          // failed to connect to Blynk cloud server so try local server
        Blynk.config(blynk_token2, blynk_server2); // Local Server access details
        mytimeout = millis() / 1000;
        while (Blynk.connect() == false) {  // try to connect to server for 10 seconds
          if((millis() / 1000) > mytimeout + 8){ // try for less than 9 seconds
            break;  // blynk.run() will kep trying to connect
          }
        }
      }
    }        
  }

If you mix and match this extract with the extracts you already have you should be good to go i.e. if user enters duff info, fall back to good hard coded credentials (with a physical button as a backup).

1 Like