• Ok, I just tried this and it would appear to be fine - apart from the IP thing.

    Here's the code I used:

    var wifi=require("Wifi");
    var net=require("net");
    var addr=null;
    function cbwi(err) {   
        if (err) {
            digitalPulse(LED1, 1, 1000);
            cowi();   
        } else {
            digitalPulse(LED2, 1, 1000);
            wifi.getIP(function(err,a) {
              addr=a;
              console.log("IP ",addr);
            });
            net.createServer((conn) => {
              conn.on('close', USB.setConsole);
              conn.pipe(LoopbackA);
              LoopbackA.pipe(conn);
              LoopbackB.setConsole();
            }).listen(23);
        }
    }
    function cowi() {
      console.log("Connecting");
      wifi.connect('...',{password:'...'}, function(err) {cbwi(err);});
    }
    cowi();
    

    I haven't seen a double callback at any point. If you're getting two callbacks it might be that cowi is getting called twice in the first place? The code you posted wasn't complete (eg. it was missing require("net")/etc) so is it possible that some of the other code you had in there was doing something?

    You could also try typing reset(true) - it's possible you had some code saved in the device already (via 'save on send?') that was trying to access WiFi.

About

Avatar for Gordon @Gordon started