[英]espruino: wifi on connect event not fired
I need to be notified when the ESP8266 get connected to the WiFi network. ESP8266连接到WiFi网络时需要通知我。 To do so I'm listening to the
connected
event in the WiFi module. 为此,我正在WiFi模块中监听
connected
事件。 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:**"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.