Need help with ESP-01s and Arduino Nano

I checked thy did not change anything,in this particular case same results,same functions and methods,and sizes of files.

Still works for me if things are set Static,not with DHCP enabled.

I can confirm that Blynk.begin method in this particular setup is not effective and ralible,
mainly because this line while(this->connect() != true) {} because makers use some strange and dirty ways which emulates semaphore programming but for this case and setup not particulary effective. It could be changed but i do not prefer that solution.

Even if Blynk.connectWiFi function calls “AT+CWJAP=” by default and not “AT+CWJAP_DEF=” AT command, it seems that ESP module remembers last joined ap, so on reconnect(power on/off,reset or reboot) it actually trys automatically to connect to the last WiFi network, and sometimes it sucessfully does connect to the last WiFi and then there is problem with Blynk.connectWiFi which trys to connect as already connected and then function wifi->joinAP(ssid, pass) returns False and exites and therefore there is no further execution of code since Blynk.connectWiFi also returns False.

To avoid that i aded this little piece of code in BlynkSimpleShieldEsp8266_h, class BlynkWifi in the beginning of function
bool connectWiFi(const char* ssid, const char* pass)
after BlynkDelay(500);
and rate of succesfully established connections very significally increases.

It is not perfect but it serves its purpose.

now it looks like this:

    bool connectWiFi(const char* ssid, const char* pass)
    {
        BlynkDelay(500);
		
		if(wifi->leaveAP()){ 
			BLYNK_LOG1(BLYNK_F("Disconnect from previous Wifi AP"));
			BlynkDelay(500);
		}
            ...
            ...
1 Like