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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You'd have to use setTimeout - or execute the connection in the handler for
getVersion
, which is called when the version has been retrieved: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 thegetVersion
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.