Avatar for allObjects


Member since Jul 2014 • Last active Jul 2018

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 Pico / Wifi / Original Espruino
    Avatar for allObjects

    The response to the post has to set render the checkbox as expected - and it most likelu doe snot do it - it just renders it by default unchecked. What's the link to the demo?

  • in Interfacing
    Avatar for allObjects

    Finally got my 433s to not sit around anymore... but for a different project I'm looking into. A real project in the field - literally: sensors in fields around a agriculture utility building/ installation. The sensors are up to 500 feet away from a central node sitting on top of the utility building.

    First thing is to get some hands-on with the wireless communication - in two parts:

    1. suitable antennas: 1/4 L ground planes for the transmitters and Slim Jim / J-pole for the receiver. None of them are directional. I may end up with directional ones for the transmitters.
    2. Explore software options to validate distance - first within 10s of feet - using simple (tuned) wire antennas.

    Latter was so far doomed... I used the 433 Espruino modules but I got nothing across... with vaious pairs (3)... so I looked into what the receiver actually puts out... and from some base analysis I may get a few bps going... like: blink - on/off - the transmitter and see the same LED on/off pattern on the receiver side. I used 2 PICOS, transmitter on 5V USB for one models, 3.3V on the other models. With first model I could go up to 12V.

    The disheartening experience already over short distance made me quickly forget the 433 ASK/OOK modulation and go for something real, like LoRa... Sure, I could pour over the various code options and use dedicated hardware on the receiver side... may be that I should be glad for the early failure...

    Now I'm waiting for the arrival of the new hardware. The ground plane antennas I can reuse. They need just retrimning: cutting the wip and radials to the new, higher frequency. Same for the J-pole and adjusting its feed point.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for allObjects

    ...just had this PUnable to retrieve board information`` in a similar setup but connecting to a PICO and trying to flash... It was a malfunctioning / spotty connection... that lead to all kinds of issues... It found the device, but could not properly / continuously communicate and stay connected. Wire connectivity is different from wireless, but in the end in the application layer - from where this message comes - it is the same. Fixing/replacing my cable and making sure it is completely plugged in both sides fixed the issue for me. But as said, I do not know what exactly to suggest for wireless situation... may be checking with BLE from a phone - to at least figure out which side has the issue?

  • in ESP8266
    Avatar for allObjects

    Testing out the LED matrix (disconnected from MAX7219 driver board) w/ a 5V source and a 470 ...1K Ohm resistor will tell you... and then you do the same with a single LED and the driver board... that will tell you what is broken... or it may just have been a cold soldering point... had those duds when working w/ flip-dots... it just did not want to work, and that's the procedure I used to get to the bottom of the issue.

  • in Projects
    Avatar for allObjects

    ...JS is NOT my favorite[...] What I can see is that for someone with no prior [JS] knowledge it is relatively easy to pick up as it is fairly compact. For someone from an OO background its a more difficult switch.

    ...oops - or - OOPSLA/ECOOP - SIGPLAN... ok, my favorite is BD or ME... but I'd not like to explain (those or myself). Any language I can express myself in and makes my vis-a-vis to get me, is my favorite (for communication) - and of course, fluency (and walking the mile in my vis-a-vis shoes) is on me. All the rest is the pic(ture) in my head - and (unfortunately), when that pic is messed up, no language ever solved it for me.

    When it comes to JS, I'm not thinking flow or structured - from flow or structured languages - but OO and Lambda - and that's the (language) pic(k) in my head (hence my screen name). In the end, hybrid is what the world is made of for me - and sometimes a elaborate concepts and their tool are just plain overkill. Under the gun of limited resources - space AND cycles - JS has for me in an optimized way what I need and Espruino HW gets me... most of the time. After all, JS is the language @Gordon made for and taught his babies - I don't mean the real one(s)... I have a sone named Pascal, but that did't help much: he skipped that part, which was my 1st love... ;-)

    I know that green thumbs help with gardening, but I don't what kind of color thumbs help with programming MCs. Something is for sure: when TS will blow my way, I know where and from whom I can get professional help.

    If you still find some time, take a (reading) look at Man a Machine

  • in Projects
    Avatar for allObjects

    ...in deed, it is JS... and that got my excitement going a while ago... and still goes on, even though I just made - at work -a very deep plunge into python - still trying to swim and not to drown (I mean to code and not to err out) ...and there are (micro) pythons similar to espruinos out there... and if power and size is not an issue, raspberry pi is the perfect platform (have to confess - to @Gordon - that I just received my 1st ordered berry... connected it - 3 B+ to display and mouse, and was blown away by it: just works, and a nice Linux is there... had not connected keyboard yet, but still could play a game (reversi). The plan is to use id from now on... as possible Espruino IDE environment and BLE bridge to WiFi / LAN - either with node.js or python... after all, I got that also going on for me...).

    I'm just surprised and frustrated the upload mechanism is so fundamentally flawed.

    That's kind of an interesting comment... As @Gordon points out, RAM is not there to store and forward and do all the things... so this is what I see happening on upload:

    1. IDE switches echo is off with a (console) command - actually a JS function - that Espruino interpreter understands (built-in)
    2. JS expressions are sent (via/through console connection) to the interpreter line by line - expressions can span multiple lines - and as soon as a complete expression is detected, it is executed... after all, it is JS and the receiving end is the interpreter.
    3. This goes on and on until the all is sent from the IDE to the board, the board has worked trough all expressions and actually built the programs object model, so to speak... almost like html DOM.
    4. The IDE then waits for a prompt to come back from the board, upon which it turns echo on again. If that prompt is not coming back in time - controlled by a (generous) timeout, or instead the control some out put comes back and confuses the IDE, then upload sequence (and switching between command and upload mode and back) falls apart... (except you do the save on send as hinted by @Gordon. Regarding the time-flakiness, matter of fact if the band-width is used up (by nose or other communications - as I read in another forum post) there is nothing that can be done to get connections right away and throughput, no matter how fast frequency hopping happens. It's almost like not having enough access points and no ip is received and no connection setup happens... and the intendedly built-in timeouts let as (at least) know about.

    You can see that by using arrow up after an upload: echo on and sent program come 'up'... that's also why after an upload you cannot get easily back to your last console command... @Nickax, keep sharing the pit falls we so glaringly glance over... RTM - Read The Manual, and more timely - WTY - Watch The Youtube can not be skipped to get the best out of any situation...

    No doubt, I can say for me - and @Gordon as well? - that we enjoy your excitement... it is received as rewards... no kidding: it spars to get and do even better than already good.

  • in General
    Avatar for allObjects

    ...once more: flakiness comes from power supply... as experienced a while back when the ESP8266 became available and communication was flaky... either with Espruino combined or Espruino on ESP8266...

    Espruino once again has proven to be rock solid!

    PS: The waits... could they be needed because reading is triggering another convert from the sensor and storing the value in the register from where it is read? Also, switching between idle and operate may play an issue - fluctuation in current... I did not read up HX711's internals...

  • in Interfacing
    Avatar for allObjects

    Just what @Gordon says... though: since you never really press them at the same time but have watches on both, you get two events in the event queue... first one is served and you check for both buttons, but you set a flag for the button you just checked so that when its press event will about to be served, you do not count it as a press, but just clear the flag... ;-)... so the code may look like this:

    // Watch Id, Flag, Callback and set watch for BTN1 and BTN2
    var w1Id = null;
    var b1F = false;
    function b1Cb() {
      if (b1F) {
        b1F = false; // ignore press event, both but reset flag
      } else {
        if (b2F = BTN2.read()) { // read and set flag for other btn (BTN2)
          console.log("Both pressed, but BTN1 made the race!");
          // ...do what to do when both buttons have been pressed simultaneously
        } else {
          console.log("Just BTN1 has been pressed!")
          // ...do what to do when BTN1 has been pressed
    var w2Id = null;
    var b2F = false;
    function b2Cb() {
      if (b2F) {
        b2F = false; // ignore press event, both but reset flag
      } else {
        if (b1F = BTN1.read()) { // read and set flag for other btn (BTN1)
          console.log("Both pressed, but BTN2 made the race!");
          // ...do what to do when both buttons have been pressed simultaneously
        } else {
          console.log("Just BTN2 has been pressed!")
          // ...do what to do when BTN2 has been pressed
    function r() { // run - enter r() in console (while testing)
      b1F = false;
      w1Id = setWatch(b1Cb, BTN1, {repeat:true, edge:"rising", debounce:20});
      b2F = false;
      w2Id = setWatch(b2Cb, BTN2, {repeat:true, edge:"rising", debounce:20});
    function h() { // halt or pause - enter p() in console (while testing)
      if (w1Id) { clearWatch(w1Id); w1Id = null; }
      if (w2Id) { clearWatch(w2Id); w2Id = null; }

    ...this is though not the full truth but the truth either... but I let you figure that out yourself... hint: what is when you press BTN1 and hold it... and then 'later' you also press BTN2 - while BTN1 is still held? ...so you may watch both edges as well as define windows where presses are presses and when they are separate ones, even though presses may overlap...


    PS: Code not tested (yet)... but it is a nice 'problem' to solve!

  • in Projects
    Avatar for allObjects

    @Nickax, sad to hear your tough start... so lucky me, it was a no brainer to leave A..o (and other decade old fun with Z8) aline and enjoy very much iot w/ JS on Espruino.

    To cut to the chase: copy-paste can have its issues since sometimes invisible rendering sequences make it into the code and mess it up.

    Take a look at some of these conversations... Temperature Web Monitor (you going for BLE), Developing Modules... latter uses the DS18B20 but just as an example to discuss the topic.

    Furthermore, as a general thing: 'never ever' - even though never ever say 'never ever' - do active things in level 0 - like setInterval(... - ... it just calls for puzzling waste of time. Unfortunately, many of the examples do so... and just get lucky most of the time. Being wired while developing, such as for Espruino Original board, Pico, Espruino-WiFi,... luck is almost guaranteed (for the small examples). With Puck and Pixl, luck is just in short supply, because over the air - ota - may get impacted from the electro smog around you and delay completion of upload - and uploading of code and firing timeouts don't like each other - as they are setup on upload when in level 0.

    Therefor, safest approach is using onInit(), even though there are other avenues that make sure that uploading completes first because any other (of your application stuff) gets underway.

    Take a look at simple explanation how to save code that espruino run on start? conversation. Even though a bit outdated, provides some insight what happens on upload and saving of code.

    btw, if you put posted code between lines that have three (3) back-ticks (accent-grave) with a blank line before and after, your code because easy to read...

  • in Projects
    Avatar for allObjects

    ...there you go... never go with requirements that include a solution (hint)... which in this case is Wifi...

    Wifi has much higher power requirements (500ma+ on calibration when establishing connection with access point).

    Amazon Echo Buttons use Blue Tooth (BLE, Blue Tooth Low Energy?) which can run on way much lower power, just check out the Espruino puck.js: the Espruino puck.js is what you are looking for...

    You still need something that connects you to Wifi to talk to your node.js server... I assume... except your server is so close and supports BLE,... or another Wifi connected device that runs BLE and can communicate with your button device... such as your Alexa station does... Any Wifi and BLE enabled device - such as a running lap top / BLE HID - can do what Alexa station does in combination with a Espruino puck.js.

    Puck.js comes with one built in physical button... if you can live with a short press for detecting press of logical button 1 and a longer press for press of logical button 2, you are just fine (think about Adam L Morse, who had one button communicated a whole character set...)

    With Espruino puck.js you may not even have to touch any hardware from the inside...

    If your server is not able to do BLE and you do not want to have a general purpose device between puck and server, take another puck to be the base station, connect it up to a few $ ESP8266 and you most likely have what you are looking for...