Hardware: ?ESP-12?
Core Version: ?2.1.0-rc2?
Problem description
I have the below code to detect lost wifi connection then re-connect (with the existing ssid and pw). and I trigger the lost-wifi by shutting down my router, but when the wifi is lost, it cause 8266 to reboot.
Module: ?ESP9266MOD-12E/F
Flash Size: ?4MB?
CPU Frequency: ?80Mhz?
Flash Mode: ?qio?
Flash Frequency: ?80Mhz?
Upload Using: ?OTA / SERIAL?
Reset Method: ?ck / nodemcu?
#include <ESP8266WiFi.h>
void setup() {
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, pass);
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
....
}else{
WiFi.begin(ssid, pass);
}
}
messages here
you do realize your flooding WiFi.begin? im not sure if theres a check inside until its finished, but, your still running it millions of times, it just aint right :P
There is a function that will do that job better, place it at end of setup():
WiFi.setAutoReconnect (true);
and a handler :)
thanks for the autoreconnect tip, it seems reset on lost connection while exchanging data with a website...