- Posts: 10
- Thank you received: 2
Nikoloudakis wrote: Hi,
I tried to construct project ESP8266 internet connected switch (EasyIoT Cloud MQTT API V1) - improved with esp-01 and after a lot of effort and debugging, i think i found 2 bugs (only for esp-01).
1)esp-01 doesn't have a BUILTIN_LED ,so in order to run it on the esp-01 I had to comment all the references in the code that was similar to BUILTIN_LED code.
2)After some manual power-down resets ,esp was going in AP-mode and some other times it connected without problem
I think there is a problem with the sketch.
When the esp restarts in my case, it immediately tries to connect to the WiFi.
In the beginning of the code we write WiFi.begin(storage.ssid, storage.pwd);
After debugging I found that sometimes after restart esp connected in the background immediately to WiFi before the code reaches WiFi.begin! Strange and odd! And after the code reaches WiFi.begin, it is already connected, so the connection fails and goes to AP mode
I inserted a statement if (WiFi.status() != WL_CONNECTED) before WiFi.begin and now I don't have a single connection failure. Hope someone can replicate these finding's, and i hope I helped someone.