You are reading a single comment by @Joakim and its replies. Click here to read the full conversation.
  • (I moved this from my comment to Please post what you're working on..)

    My brother had the idea of giving our parents a Qigong button. He had that idea a few hours before our Christmas gathering, so I just had to go for it and try to make a working prototype as fast as I could. I couldn't get the espruino package to work at the time, so I had to use Web Bluetooth instead. I had never used the Puck.js web library before, so it took a bit of poking around to understand how it worked, plus some odd issues, but I got a prototype ready just in time. My parents loved it – the rest of the family had no clue what on earth Qigong was and what it had to do with that strange looking button…

    Some issues I encountered:

    • You can't connect to a Puck from a website without a user action, like pressing a <button> (I should've RTFM..)
    • The Web Bluetooth example's onLine() function receives data with a trailing newline, because the Puck uses "\r\n" instead of "\n" which the code expected. It was an easy fix, but took some time to figure out as Chrome's dev tools didn't show the trailing newline.
    • Just as I got it working, the Puck wouldn't show up anymore when trying to connect :/ Turning Bluetooth off and on again didn't help, but rebooting my laptop did. That is Bluetooth's biggest weakness if you ask me, pairing can be very shaky at times.. Edit: I've since learned that a BLE peripheral won't advertise itself when connected, and if it gets stuck in connected mode you can remove the pairing, thanks to this.
    • The first time the button is pressed after connecting, the returned data (a string: "qigong") is prefixed by ">" when passed to onLine(). Not sure why that is – any ideas?
    • It's impossible to paint on silicon! We ended up using black Tec7 paste, which actually worked pretty well.

    You can check out the code here:
    https://gitlab.com/joakimstai/qigong-button

    And if you want to practice Qigong, try it out with your Puck here:
    http://qigong-button.netlify.com

    When connected, your Puck will be reset() and my code written to it. I'm using a bit of a hack to write any function's body to the Puck when connecting, for rapid prototyping. That way I could quickly change the code on the website and Puck at the same time.

    Now I just have to get it working in Node with noble.

About

Avatar for Joakim @Joakim started