I need to be notified when the ESP8266 get connected to the WiFi network.
To do so I'm listening to the connected event in the WiFi module.
The callback function is never called.
The code:
var wifi = require("Wifi");
wifi.on('connected', function(details) {
console.log('connected to wifi', details);
});
wifi.connect("*****", {password:"****"}, function(err){
console.log("connected? err=", err, "info=", wifi.getIP());
});
The output:
>
=undefined
connected? err= null info= {
"ip": "192.168.1.105",
"netmask": "255.255.255.0",
"gw": "192.168.1.1",
"mac": "5c:**:7f:**:7a:**"
}