BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Arduino nano + esp01 blynk lost wifi connection blynk.begin

Hi I have a big problem with the arduino nano + wifi esp01 that I can’t solve in a long time, in practice when the wifi connection is missing, the program stops on blynk.begin and doesn’t go further, I have to turn off the power to arduino and then reconnect if the wifi is already on. I had already tried via avr / wdt.h with wdt 8S but unfortunately 8 seconds are not enough for me to connect via wifi. How can I solve this problem ? ,
Thanks

   /* Comment this out to disable prints and save space */
#include <ESP8266_Lib.h>
#define ESP8266_BAUD 115200
#define EspSerial Serial // Hardware Serial on Mega, Leonardo, Micro...
ESP8266 wifi(&EspSerial);
#define BLYNK_PRINT Serial 
#include <BlynkSimpleShieldEsp8266.h>

char ssid[] = "test"; char pass[] = "test";  char auth[] = "a389dbba6ddfsfwefe46drtthyu43"; 
   
void setup() { 
  Serial.begin(115200);
  EspSerial.begin(ESP8266_BAUD); 
  Blynk.begin(auth, wifi,ssid, pass); 
}
void loop() { 
   Blynk.run();
 
}

Use Blynk.config instead, give it a try.

1 Like

Hello psoro , with Blynk.config i receive

no matching function for call to ‘BlynkWifi::config(char [33], ESP8266&, char [10], char [12])’

You have to call the function correctly as follows:

void setup() 
{ 
    // Don't need this for UNO/Nano
    //Serial.begin(115200);
    EspSerial.begin(ESP8266_BAUD); 
    // This is blocking call, use Blynk.config() instead
   //Blynk.begin(auth, wifi,ssid, pass); 

    Blynk.config(wifi, auth);
    Blynk.connectWiFi(ssid, pass);

    int i = 0;
    while ((i++ < 20) && !Blynk.connect()) 
    {
        delay(500);
    }
 }
     
1 Like

again thanks for your help :slight_smile: now reconnects to perfection.