The ESP8266 using the Arduino Core reports Wi-Fi status with the WiFi.status() function. The D1M-WX1 Weather Station attempts to connect to Wi-Fi every 250 milliseconds until the “Connect” status is found. If this does not happen after 15 attempts, it prints the status to the Serial Monitor.
Normally, the LED on the ESP8266 flashes five or six times until the connection is made. The LED will be dark during the six or seven seconds it takes to post the weather data on the Internet. It will flash three times before the station goes to sleep for 10 minutes. The code is in the logonToRouter() function of the weather station sketches.
If a Wi-Fi connection can not be made, the LED will flash 16 times and the exit code will appear on the Serial Monitor. The status codes are:
ESP8266 WiFi Result Codes
|1||No SSID Available||Unit is too far from the Wi-Fi access point, the SSID and/or password is incorrect, or the SSID is for a 5GHz-band access point.|
|2||Scan Completed||Scanning for available networks is completed.|
|4||Connection Failed||The opposite of success.|
|255||No Shield||Used for compatibility with the Arduino WiFi Shield - not relevant to the ESP8266.|