Ooohhhhhh, it works. I understand now.
Instead of typing require("EspruinoWiFi") in the left pane, it has to go in the right pane:
require("EspruinoWiFi")
var wifi = require("EspruinoWiFi");
Press Send to Espruino
Send to Espruino
dump() // left pane var wifi = { "connect": function (a,b,c) {var f="";void 0!==b.password&&(f=b.password);m(1,function(b){if(b)return c(b);d.cmd("AT+CWJAP="+JSON.stringify(a)+","+JSON.stringify(f)+"\r\n",2E4,function x(a){if(0<=["WIFI DISCONNECT","WIFI CONNECTED","WIFI GOT IP","+CWJAP:1"].indexOf(a))return x;"OK"!=a?setTimeout(c,0,"WiFi connect failed: "+(a?a:"Timeout")):setTimeout(c,0,null)})})}, "disconnect": function () {r(1)}, "getIP": function (a) {var b={};d.cmd("AT+CIFSR\r\n",1E3,function f(d){if(void 0===d)a("Timeout");else{if("+CIFSR:STAIP"==d.substr(0,12))b.ip=d.slice(14,-1);else if("+CIFSR:STAMAC"==d.substr(0,13))b.mac=d.slice(15,-1);else if("OK"==d){a(null,b);return}return f}})}, "startAP": function (a,b,c) { b=b||{};if(!b.password||8>b.password.length)throw Error("Password must be at least 8 characters");var f=b.password?"3":"0";if(b.authMode&&(f={open:0,wpa:2,wpa2:3,wpa_wpa2:4}[b.authMode],void 0===f))throw Error("Unknown authMode "+ b.authMode);void 0===b.channel&&(b.channel=5);m(2,function(e){if(e)return c(e);d.cmd("AT+CWSAP="+JSON.stringify(a)+","+JSON.stringify(b.password)+","+b.channel+","+f+"\r\n",5E3,function(a){"OK"!=a?c("CWSAP failed: "+(a?a:"Timeout")):c(null)})}) }, "stopAP": function () {r(2)}, "scan": function (a) { var b=[];m(1,function(c){if(c)return a(c);d.cmdReg("AT+CWLAP\r\n",5E3,"+CWLAP:",function(a){a=a.slice(8,-1).split(",");b.push({ssid:JSON.parse(a[1]),authMode:w[a[0]],rssi:parseInt(a[2]),mac:JSON.parse(a[3]), channel:JSON.parse(a[4])})},function(c){a(null,b)})}) } }; =undefined
So if I upload code that isn't messed up (trying to support __non_webpack_require__ causes issues) I think this will work once again.
__non_webpack_require__
Getting into bootloader probably not working still :(
@CriscoCrusader 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.
Ooohhhhhh, it works. I understand now.
Instead of typing
require("EspruinoWiFi")
in the left pane, it has to go in the right pane:Press
Send to Espruino
So if I upload code that isn't messed up (trying to support
__non_webpack_require__
causes issues) I think this will work once again.Getting into bootloader probably not working still :(