This is an infinite looop and you’re not feeding the watchdog here. Also this code will not turn off the LED when WiFi is disconnected - it just exists the loop and does nothing. No explicit digitalWrite
with LOW
is done.
Just put it in loop
as a check.
void loop()
{
//most builtin LEDs on ESP8266 boards I've seen seen are *inverted*.
//writing LOW to them will turn the LED on.
//switch LOW and HIGH if needed else..
digitalWrite(LED_BUILTIN, (WiFi.status() == WL_CONNECTED) ? LOW : HIGH);
}
Activate debug log level as show in docs by using
build_flags = -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI
then post log of the ESP8266 when it connects.