//getAps1.js 11Jan2018 //espruino board with ESP8266 //PICO with ESP8266 //var Hardware=0; //Espruino board var Hardware =1; //PICO var Serial; var Startagain=0; var myinterval; function test(){ if(Hardware===1)Serial=Serial2; if(Hardware===0)Serial=Serial4; if(Hardware===1){ digitalWrite(B9,1); // enable on Pico Shim V2 Serial.setup(115200, { rx: A3, tx : A2 }); //Pico } if(Hardware===0)Serial.setup(115200, { rx: C11, tx : C10 }); //espruino board console.log("Start connection process"); var wifi = require("ESP8266WiFi_0v25").connect(Serial, function(err) { if (err){Startagain=1;return;} console.log("Reset the ESP8266"); wifi.reset(function(err) { if (err){Startagain=1;return;} wifi.getAPs(function(err,reply){console.log(err,reply); wifi.getVersion(function(err,reply){console.log(err,reply);}); }); });//end reset console.log("end reset"); });//end require console.log("end require"); }//end test myinterval=setInterval(function () { console.log("Test for error"); if(Startagain){ Startagain=0; test(); }//end of Startagain }, 2000); test();
1v94 Copyright 2016 G.Williams >Start connection process end require =undefined Reset the ESP8266 end reset Test for error Test for error null [ { "ssid": "ATT5wAn8b9", "enc": "wpa_wpa2_psk", "signal": -79, "mac": "f8:18:97:d5:63:06" }, { "ssid": "ATT3x349v4", "enc": "wpa2_psk", "signal": -84, "mac": "cc:65:ad:7e:e2:20" }, { "ssid": "xfinitywifi", "enc": "open", "signal": -81, "mac": "c6:27:95:38:8b:48" }, { "ssid": "xfinitywifi", "enc": "open", "signal": -48, "mac": "16:4e:5a:94:24:e4" }, { "ssid": "xfinitywifi", "enc": "open", "signal": -90, "mac": "c6:27:95:38:c5:20" }, { "ssid": "BLACKHAWKS19", "enc": "wpa_wpa2_psk", "signal": -81, "mac": "c4:27:95:38:8b:46" }, { "ssid": "NETGEAR60", "enc": "wpa2_psk", "signal": -85, "mac": "e4:f4:c6:17:27:50" }, { "ssid": "NETGEAR-Guest", "enc": "wpa2_psk", "signal": -84, "mac": "e6:f4:c6:17:27:51" }, { "ssid": "faux", "enc": "wep", "signal": -49, "mac": "20:4e:7f:03:87:cd" }, { "ssid": "HOME220-2.4", "enc": "wpa_wpa2_psk", "signal": -82, "mac": "70:54:d2:07:7c:c0" }, { "ssid": "xfinitywifi", "enc": "open", "signal": -84, "mac": "70:54:d2:07:7c:c2" }, { "ssid": "AMKUS146", "enc": "wpa2_psk", "signal": -90, "mac": "9e:d3:6d:bb:a8:5c" }, { "ssid": "ATT6UuI5FT", "enc": "wpa_wpa2_psk", "signal": -88, "mac": "f8:18:97:b6:71:32" }, { "ssid": "HP-Print-1E-Officejet Pro 8610", "enc": "wpa2_psk", "signal": -88, "mac": "fc:15:b4:aa:a9:1e" }, { "ssid": "HOME-24D1-2.4", "enc": "wpa_wpa2_psk", "signal": -83, "mac": "0c:54:a5:64:cf:c0" }, { "ssid": "xfinitywifi", "enc": "open", "signal": -83, "mac": "0c:54:a5:64:cf:c2" } ] null AT version:0.60.0.0(Jan 29 2016 15:10:17) Test for error Test for error Test for error >reset(); =undefined
1 Attachment
@ClearMemory041063 started
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.
GetAps1 Using the functions in the WiFi module
The Code
Sample Output
1 Attachment