Avatar for goliatone

goliatone

Member since Aug 2015 • Last active Feb 2017
  • 2 conversations
  • 7 comments

Most recent activity

    • 30 comments
    • 7,837 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for goliatone

    So I wonder if the inconsistency we see is with the puck originating the connection, and not so much with the puck accepting the connection.

    I'm wondering the same thing. I also wonder if caching the connection makes it less reliable. Will make a quick test and see.

    I've got the EspruinoHub up and running with some changes I made to it. Connecting to a puck seems very fast and reliable.

    I actually saw your cloned repo, and I'm testing that right now. One thing I noticed is when you look at the history of the files you modified you can't see the actual changes you made since the whole file seems to be different- due to formatting changes, maybe. I think it would be good if you contributed back your changes upstream, but I personally wouldn't accept a PR in the current state. Just my 2c.

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

    Ok, 1v90.12 fixes the error and the updated script.

    I see it fail, and then on next press it tries to connect again. However, quite often it will fail- red LED lights up- a few times in a row before the command it's sent successfully.

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

    There was a bug around promise rejection that was fixed by @Gordon link

    I have upgraded to 1v90.5 and I the issue seems to persist.

    The reason for the rejection is the pucks will disconnect from each other after a minute or two

    This makes sense.

    --
    I noticed that the version provided in the link- 1v90.5- is not present in the "binaries folder".

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

    FYI The updated firmware provided in the previous post seems to be missing in the "binaries folder".

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

    @dklinkman thanks for the reply. No, I have not updated the firmware. Will do.

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

    Hi,
    I just got my Pucks and decided to start playing with them, I'm really impressed and I really like the quality of the hardware and how easy/smooth it was to get up and running.

    Following the tutorial Controlling Other Pucks I ran into an error:

    Uncaught Error: Unhandled promise rejection: undefined at line 34 col
    26 txType.writeValue('Puck.js d5b2').then(()=>{ in function called
    from system

    The code runs perfect initially, but when I click the central Puck after a couple minutes of inactivity I get the previous error. I wont post the source code since it's a copy paste from the tutorial.

    I find the error message confusing since the Promise seems to be handled?

    txCharacteristic.writeValue("toggle()\n"­).then(function() {
            digitalPulse(LED2, 1, 500); // light green to show it worked
            busy = false;
          }).catch(function() {
            digitalPulse(LED1, 1, 500); // light red if we had a problem
            busy = false;
          });
    

    The peripheral Puck seems to be working OK. I modified the source to handle manual press

    var on = 0;
    function toggle() {
      on = !on;
      digitalWrite(LED, on);
    }
    
    setWatch(toggle, BTN, {edge:'rising', debounce:50, repeat: true});
    
  • in General
    Avatar for goliatone

    I have an arduino sketch that I would like to port JavaScript and run on a pico.
    The sketch is reading input from pins 2 and 3 and then attaching two interrupts to get 0/1 bits.

    What would be the way to achieve this using a pico?

    The following is an excerpt of the sketch I'm using, I could post the whole script but I figured this encompasses the core of my question.

    void ISR_INT0()
    {
        bitCount++;
        flagDone = 0;
        pulseCounter = WAIT_TIME;
    
    }
    
    void ISR_INT1()
    {
        databits[bitCount] = 1;
        bitCount++;
        flagDone = 0;
        pulseCounter = WAIT_TIME;
    }
    
    void setup()
    {
        pinMode(13, OUTPUT);   // LED
        pinMode(2, INPUT);     // DATA0 (INT0)
        pinMode(3, INPUT);     // DATA1 (INT1)
    
        Serial.begin(115200);
        Bridge.begin();
    
        while (!Serial);
    
        attachInterrupt(1, ISR_INT0, RISING);
        attachInterrupt(0, ISR_INT1, RISING);
    
        pulseCounter = WAIT_TIME;
    }
    
    void loop()
    {
        if (!flagDone)
        {
            if (--pulseCounter == 0)
            {
                flagDone = 1;
            }
        }
    
        // if we have bits and we the pulse counter went out
        if (bitCount > 0 && flagDone)
        {
            //... logic removed
            bitCount = 0;
        }
    }
    
Actions