Avatar for joshfarrant


Member since May 2017 • Last active May 2017
  • 1 conversations

Most recent activity

  • Avatar for joshfarrant

    Great, thanks, I'll try that this evening.

    I wasn't knowingly downloading anything, but of course the OS could have been doing something in the background. I've got a Pi 3 coming in the next few days, so we'll see how it goes with that too.

    Massive thanks for your help, both!

  • Avatar for joshfarrant

    Currently the puck is right next to the MacBook, maybe 15 cm away. When I come to actually use it, however, it will be on top of a table with a Raspberry Pi 3 underneath the table, maybe 40cm away.

    I'll have a look at the NRF.setTxPower function and see if that helps. How would I go about increasing the advertising rate? Currently I'm just calling NRF.setAdvertising() once, should it be inside a setInterval to call it repeatedly?

    If it's of any use at all, here's a gist of the code.

    Regarding the button presses, I'm currently doing the same sort of thing as knolleary suggested, which is to advertise 0, increment to 10 on first push, 20 on second etc, then reset to 0 after a few seconds. Maybe I will try having a basic counter that increments the number by 1 on each press, then just look for increases in my node script. At least I can guarantee that I'll notice the button press, no matter how long it takes.

  • Avatar for joshfarrant

    Thanks, @knolleary, that's really useful!

    One question - Did you see somewhat erratic times between the .on('discover') event firing? I'm running essentially the same code as you linked and I'm seeing anywhere between 1.5 seconds and 20 seconds between each .on('discover') event.

    Not ideal when I'm trying to use the Puck.js as a light switch!

  • Avatar for joshfarrant

    @knolleary Did you ever make any code publicly available? Got the basics working in the same way as your example above, but would be really useful to see some more complete code if you've got it.

  • Avatar for joshfarrant

    Hey again Gordon,

    That looks perfect, I'll give it a try!

    After your advice on my GitHub issue yesterday I did look into using Puck.js as a HID and that seemed like it could work well, but the advertising example looks like a cleaner way to approach it to me.

    If it works out I'll throw together a short blog post on it, as I spent a good few hours searching for examples on how others had approached this problem and couldn't find anything that didn't involve Node-RED.

    Thanks again for taking the time!

  • Avatar for joshfarrant

    Hey all,

    Brand new to Puck.js and enjoying playing around with it so far.

    I'm trying to put a simple node script together that can detect the Puck's button press so I can run a couple of things on each press. I'm having a bit of trouble figuring out where to start, however.

    I'm guessing that the best way to do this would be over a Bluetooth connection, but I'm having trouble finding the relevant docs or any examples to help get this started.

    If anyone's got any advice it would be greatly appreciated.