Avatar for CriscoCrusader


Member since Nov 2016 • Last active Apr 2017
  • 13 conversations

Most recent activity

  • in General
    Avatar for CriscoCrusader

    My bad. I've used that before, I think it's quite good, and I see these functions are there too. I'm really sleep deprived, that will be my excuse. Sorry for being a nuisance :). Thanks as always.

  • in General
    Avatar for CriscoCrusader

    I didn't know it has that feature! Trying it now, but seem to be having troubles.

    Using first port, {"path":"/dev/cu.usbmodem1421","usb":[11­55,22336],"description":"Espruino board"}
    Connecting to '/dev/cu.usbmodem1421'
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/NetworkJ­S.min.js
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/net.min.­js
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/net.js
    Module net not found
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/NetworkJ­S.js
    Module NetworkJS not found

    I'll probably figure out why this happens. I see these same messages sometimes in the IDE, but it's fixed if I reset();save();.

  • in General
    Avatar for CriscoCrusader

    To get into the bootloader you just power the board up with the button held down - does that not work?

    It does not appear to be working. What does the yellow LED mean?

    For modules that have to be loaded off the internet you have to use the right-hand side of the IDE so the IDE can detect their use and load them automatically. The left-hand side goes direct to the Espruino Board, so if it doesn't know about a module it's unable to load it.

    Ya, see how it works now.

    It'd be worth going through the quick start and a few of the Espruino Pico tutorials - I think a lot of this stuff is covered already there - it might save you some time :)

    I did when I got my first board. I saw the section about save and onInit at the time, but I didn't try it out, and I forgot those features existed. I don't learn well by reading, I learn by doing, which is apparently uncommon among developers. FWIW, the Lodash project documentation is really easy to work with. Would be super if Espruino could have similar documentation at some point in the future.

  • in General
    Avatar for CriscoCrusader

    Would be nice if there was a way to have the right panel load from my file before sending to Espruino. I would be able to work in my preferred editor, Sublime Text. The Web IDE has a clumsy aspect to it (at least one Macs) because it's a Chrome App, so changing to Chrome using CMD + Tab brings the Web IDE to the front, covering all of Chrome (since I'm on a laptop the majority of the time). So I then have to hit CMD + ` (this hotkey is for changing between multiple windows of the same program on Macs).

    I tried the Web IDE in a tab for the first time just now, but it can't find my Espruino.

    I guess that for now, I'll just have to use another browser besides Chrome, when I'm working with Espruino.

  • in General
    Avatar for CriscoCrusader

    Thanks, Gordon. I did go through the FAQ's, it's not there. I might have looked through the quick start guide, can't remember, but you're right that it's explained there.

  • in General
    Avatar for CriscoCrusader

    Ooohhhhhh, it works. I understand now.

    Instead of typing require("EspruinoWiFi") in the left pane, it has to go in the right pane:

    var wifi = require("EspruinoWiFi");

    Press Send to Espruino

    dump() // left pane
    var wifi = {
      "connect": function (a,b,c) {var f="";void 0!==b.password&&(f=b.password);m(1,funct­ion(b){if(b)return c(b);d.cmd("AT+CWJAP="+JSON.stringify(a)­+","+JSON.stringify(f)+"\r\n",2E4,functi­on 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);el­se 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.len­gth)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.authMo­de],void 0===f))throw Error("Unknown authMode "+
    b.authMode);void 0===b.channel&&(b.channel=5);m(2,functio­n(e){if(e)return c(e);d.cmd("AT+CWSAP="+JSON.stringify(a)­+","+JSON.stringify(b.password)+","+b.ch­annel+","+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.pa­rse(a[3]),

    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 :(

  • in General
    Avatar for CriscoCrusader

    I think I fixed it!

    Reading other threads, learned about dump().

    // Code saved with E.setBootCode
    var WIFI_NAME = "XXXXXX";
    var WIFI_PASS = "XXXXXX";
    var MQTT_HOST = "";
    if (typeof __non_webpack_require__ == 'undefined') {
      var __non_webpack_require__ = require;
    var mqtt = __non_webpack_require__("MQTT");
    var wifi = __non_webpack_require__("EspruinoWiFi");­
    var client = mqtt.create(MQTT_HOST);
    client.on('connected', function() {
    client.on('publish', function(pub) {
      console.log("topic: "+pub.topic);
      console.log("message: "+pub.message);
    wifi.connect(WIFI_NAME, { password: WIFI_PASS }, function(err) {
      if (err) {
        console.log("Connection error: "+err);

    That's my project code! And a clue! // Code saved with E.setBootCode.

    Let's try this then...

    Erasing Flash...
    Compressed 114368 bytes to 8

    Hooray! Right?

    >var wifi = require('EspruinoWiFi')
    ERROR: SD card must be setup with E.connectSDCard first
    WARNING: Module "EspruinoWiFi" not found