• Hi There
    I just received a few espruino.wifi boards. Nice work!

    I try to detect the connected or disconnected event without success. I did not get any of this two events. No connected event on connect and no disconnect event when i switch off my wifi AP.

    Code:

    var wifi = require("EspruinoWiFi");
    var WIFI_NAME = "XYZ";
    var WIFI_OPTIONS = { password : "PW" };
    
    console.log('Starting...');
    
    wifi.on('connected', function(data) {
        console.log("> connected "+data);
    });
    wifi.on('disconnected', function(data) {
        console.log("> disconnected "+data);
    });
    
    wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
        if (err) {
            console.log("Connection error: "+err);
    
            return;
        }
        wifi.getIP(function(f,ip) {
            console.log("Connected: ", ip);
        });
    });
    

    The console output is:

    _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v94 Copyright 2016 G.Williams
    >Starting...
    =undefined
    Connected:  {
      "ip": "192.168.68.175",
      "mac": "5c:cf:7f:c0:14:c8"
     }
    >
    
About

Avatar for Sacha @Sacha started