• I have the pucks named "c123" (master), and "ae23" (slave).
    I followed the description at https://www.espruino.com/Puck.js+Control­ling+Other+Pucks
    1) slave: code copied to puck named "ae23" and save()
    2) master: puck name changed to "...filters: [{ name: 'Puck.js c123'..." , code copied and save()

    Testing with and without loading "require("ble_simple_uart")" on WEB IDE via "Send to Espruino"

    The result is always
    a) master: the blue LED is on (OK), then the red LED is on (KO)
    b) slave does nothing

    What do I do wrong?
    Thanks for the answer!

  • It sounds like you've got the master/central "c123" (the one doing the connecting) trying to connect to itself with ...filters: [{ name: 'Puck.js c123'...?

    I think you need: ...filters: [{ name: 'Puck.js ae23' instead and you should be ok?

  • oh, sorry, my copy/paste was wrong here :-(
    here is the test what I made, and I have the problem in this version:

    var on = 0;
    function toggle() {
      on = !on;
      digitalWrite(LED, on);
    --> save();
    // Are we busy?
    var busy = false;
    // Function to call 'toggle' on the other Puck
    function sendToggle() {
      if (!busy) {
        busy = true;
        digitalPulse(LED3, 1, 500); // light blue to show we're working
        NRF.requestDevice({ filters: [{ name: 'Puck.js ae23' }] }).then(function(device) {
          require("ble_simple_uart").write(device,­ "toggle()\n", 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;
    // Call sendToggle when the button is pressed
    setWatch(sendToggle, BTN, { edge:"rising", debounce:50, repeat: true });
    --> save();
  • Is it possible that you're still connected to the slave device with your PC?

    Espruino BLE devices can only have one device connected to them at a time, so if you're connected with your PC, the 'master' device won't be able to connect.

    Also, if you stay connected with the 'master' you could change the code to:

        }).catch(function(e) {
          digitalPulse(LED1, 1, 500); // light red if we had a problem
          busy = false;

    And you might be able to see what error it is complaining about

  • Thank you Gordon, it's working now!
    I think the require("ble_simple_uart")" on WEB IDE via "Send to Espruino" was not correctly executed - it runs now fine.

  • I tried now also the 2nd example ( at "Making it faster" ):
    Here I have the following problem:
    1) I press the button on master-puck, the green LED lights; now the red LED lights also on the slave-puck(this is OK);
    2) if I press the master-puck again, the red LED is OFF on slave-puck (this is OK also);
    3) I play this 3 times (on and off)
    4) After the 7. button press on master-puck, the green LED is always lights on master-puck, but the slave-puck do nothing. Only if I make a reset() and a new load/code copie to the master can I run this procedure again.
    5) .. and I cannot connect anymore to my slave-puck via WEB IDE, I must remove/put in again the battery

    What could be the problem here?

  • I just found: if I re-insert the batteries after the 4) step above (without re-loading the codes), then everything work correctly. So I think it's not a problem anymore.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Puck2.js Master/Slave: probem (red LED) when establishing the connection

Posted by Avatar for user67655 @user67655