Skip to main content
1 of 3
Juraj
  • 18.3k
  • 4
  • 32
  • 50

The esp8266 SDK libraries starts the STA connection, but it is handled by other thread than the Arduino sketch. You can wait for this connection in setup with waitForConnectResult. It returns status().

 if (WiFi.waitForConnectResult() != WL_CONNECTED) { Serial.println("Not connected"); WiFi.begin(ssid, pss); digitalWrite(0, LOW); digitalWrite(2, HIGH); } else { Serial.println("Connected"); digitalWrite(0, HIGH); digitalWrite(2, LOW); } 
Juraj
  • 18.3k
  • 4
  • 32
  • 50