ESP8266 how to connect to wifi automatically?

Posted on
  • If my wifi config saved then I don't need to try to do wifi.connect()?

    but how do I know when to skip this wifi.connect()?

  • I test for an IP address. This could probably be refined, but generally the ESP8266 connects to wifi quickly or not at all, say if the config is wrong:

    if (wifi.getIP().ip != "0.0.0.0") {
      // rest of your code
    } else {
      console.log("not connected to wifi");
    }
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ESP8266 how to connect to wifi automatically?

Posted by Avatar for user102526 @user102526

Actions