• You'd have to use setTimeout - or execute the connection in the handler for getVersion, which is called when the version has been retrieved:

    wifi.getVersion(function(err, version) {
      print(err,version);
      console.log("Connecting to WiFi");
      // ...
    });
    

    Is it repeatable?

    The error you were getting (no change) is I think a result of the fact that you're not resetting the WiFi - rather than related to the getVersion call? The ESP8266 was already connected to that WiFi network, so it's telling you that it had nothing to do.

    I guess the library should deal with that eventuality, but the example code resets the WiFi before connecting so it's not generally an issue.

About

Avatar for Gordon @Gordon started