Avatar for allObjects

allObjects

Member since Jul 2014 • Last active Jul 2017

Very excited about Espruino! JS is just a great, universal language that - for me - implements - thank's @Gordon on an ARM3/4/... MC and with a Web IDE - all essential programming concepts there are and makes them easy to use, including the hardware access. My relationship with The Flintstones is about the same as Espruino and Arduino..., or JS and C... not that C-like things are not of use or needed anymore, but I can get most of them close enough with compiled JS.

Most recent activity

  • in Interfacing
    Avatar for allObjects

    Looking at the MAX7291 and family datasheet, I see 5V operation (minimum 4V). Trying to run it with 3.3V does for sure call for trouble... also the power consumption could be an issue.

    What Espruino Board are you using to drive the display board?

  • in Projects
    Avatar for allObjects

    @user54159 , check your forum messages...

  • in Projects
    Avatar for allObjects

    ...got a bit stuck in doc and work... will show in public in a bit...

  • in Pico / Wifi / Original Espruino
    Avatar for allObjects

    Sometimes it is difficult to keep the switch pressed while powering / plugging in the micro USB connector. To make it work reliably, I plug the USB cable first to the Espruino Wifi, then press and hold the switch and plug the other end of the cable into the USB connector of my computer.

  • in Pico / Wifi / Original Espruino
    Avatar for allObjects

    What board model is it?

  • in General
    Avatar for allObjects

    Tried in console the following... according to Modules reference:

    >reset()
    =undefined
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v92 Copyright 2016 G.Williams
    >Modules.removeAllCached();
    =undefined
    >Modules.getCached()
    =[  ]
    >Modules.addCached("credsTest",'{ssid: "ssidVal"}');
    =undefined
    Uncaught SyntaxError: Got ':' expected EOF
     at line 1 col 8
    {ssid: "ssidVal"}
         ^
    >Modules.addCached("credsTest",'{"ssid":­ "ssidVal"}');
    =undefined
    Uncaught SyntaxError: Got ':' expected EOF
     at line 1 col 8
    {"ssid": "ssidVal"}
           ^
    > 
    

    Both - non-JSON and JSON - ways fail... I suspect that the new feature to load modules as a function meddles with the previous workings... may be the issue is with both, upload AND pull ( require("..."); )...

    @Gordon, could it be that the feature of saving modules as functions is doing things differently?

    *** BUT*** *** BUT*** *** BUT*** *** BUT*** *** BUT***

    Doing it in a module:

    // credsTest.js
    exports = { ssid: "ssidVal", pw: "pwValue" };
    

    ...and in the code as follows:

    // credsObjTest.js
    var creds = require("credsTest");
    function onInit() {
      console.log("creds object:");
      console.log(creds);
      console.log("Modules as loaded:");
      console.log(Modules.getCached());
    }
    // for the laxy developer at development time:
    setTimeout(onInit,1000);
    

    ...I get this output on upload:

    >
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v92 Copyright 2016 G.Williams
    >
    =undefined
    creds object:
    {
      "ssid": "ssidVal",
      "pw": "pwValue"
     }
    Modules as loaded:
    [
      "credsTest"
     ]
    > 
    

    The last line is only that I do not have to enter onInit() in the console. Saving the code without the last line on my PICO I get following output (...because save() invokes onInit() and I'm still connected):

    >save()
    =undefined
    Erasing Flash.....
    Writing.....
    Compressed 81600 bytes to 3066
    Checking...
    Done!
    Running onInit()...
    creds object:
    {
      "ssid": "ssidVal",
      "pw": "pwValue"
     }
    Modules as loaded:
    [
      "credsTest"
     ]
    > 
    

    @ClearMemory041063, I do not know what it fighting you...

    @Gordon, made another try in the console with (modules source code and not just source code):

    >reset()
    =undefined
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v92 Copyright 2016 G.Williams
    >Modules.removeAllCached();
    =undefined
    >Modules.getCached();
    =[  ]
    >Modules.addCached("credsTest",'exports = {ssid: "ssidVal"};');
    =undefined
    >Modules.getCached();
    =[
      "credsTest"
     ]
    >require("credsTest");
    ={
      "ssid": "ssidVal"
     }
    > 
    

    And it works, works, works,... nothing is broken... (so: @Gordon, never mind my comments from before...)

  • in Interfacing
    Avatar for allObjects

    @Gordon, great idea... and the IP can be put into a module to externalize the same way as the network credentials - SSID and password - as mentioned in this (and another) post.

    You place the module code

    /* credsXYZ.js */
    exports = { id: "XYZ", ssid: "...", pw: "...", ip: "..." };
    

    as credsXYZ.js into your project's sandbox .../modules folder and pull it into your code and use it this way:

    var creds = require("credsXYZ");
    // ...
    ... .connect(creds.ssid,creds.pwd,...
    //  
    ... .get(creds.ip,...
    

    The creds object can be complemented with other information you need, but at some point you will just create another object of less data privacy and call it cfg and store and use it the same way as the creds object.

    Giving the module a suffix (and id to the object) - such as XYZ - you can have multiples and load the code to the different devices with respective credentials and configuration.

    2cts about code modularity / reuse / 'hiding'.

  • in Pico / Wifi / Original Espruino
    Avatar for allObjects

    EspruinoWiFi documentation explains that the 3.3v pin [ J2-3 ] is an output

    That's true when you power thru 5V, because the 5V go to the 3.3V onboard voltage regulator and show up at the 3.3V pin for feeding other devices that need 3.3V (but at the same time do not overload the regulator when all the onboard things go on).

    It is an input when powering with 3.3V directly.

    This is the reason that you should power it from both sides, because then the powered regulator fights the 3.3V powering device... (Btw, this constraint is only for Espruino-Wifi. Original board and PICO have an additional component on board that prevents - in default setting - havoc when power is applied to both, USB/5V and 3.3V.

  • in Interfacing
    Avatar for allObjects

    ...get Web sockets going... or on a higher level mqqt... there are plenty examples out there...

Actions