Limiting Wifi connection attempts
Posted: Wed Jul 19, 2017 5:03 am
Hi there
I wonder if anyone would be kind enough to help me with a small problem. I have built and designed a small circuit that uses the esp8266 to send data to Thingspeak.com. It works brilliantly except for one small or big flaw. It is battery operated and uses deep sleep to save power, however it drains the battery when the internet connection is down or fails to connect by constant repeated attempts to connect.
I wish to limit the connection attempts to say 3 goes and then simply miss the current reading and go to deep sleep as would happen normally.
My code is the standard connection routine
WiFi.disconnect();
WiFi.begin("VM172234-2G","Pasword");
while ((!(WiFi.status() == WL_CONNECTED))){
delay(300); }
I am sure a simple and elegant solution is easy
Thanks in advance
Tim
I wonder if anyone would be kind enough to help me with a small problem. I have built and designed a small circuit that uses the esp8266 to send data to Thingspeak.com. It works brilliantly except for one small or big flaw. It is battery operated and uses deep sleep to save power, however it drains the battery when the internet connection is down or fails to connect by constant repeated attempts to connect.
I wish to limit the connection attempts to say 3 goes and then simply miss the current reading and go to deep sleep as would happen normally.
My code is the standard connection routine
WiFi.disconnect();
WiFi.begin("VM172234-2G","Pasword");
while ((!(WiFi.status() == WL_CONNECTED))){
delay(300); }
I am sure a simple and elegant solution is easy
Thanks in advance
Tim