• Hi,

    I'm trying to figure out the most effective way to trigger an action on a Raspberry Pi when the button is pressed on a puck. It feels like an obvious thing to do, but I couldn't find an example in the forum or the tutorials.

    My first attempt involved turning the puck into a HID keyboard and capture the corresponding key event on the pi.

    I used the first example code from here: https://www.espruino.com/Puck.js+Keyboar­d, verified it worked when connected as a HID keyboard to my Mac. That worked. But then I couldn't get it to pair as a HID keyboard with the Pi. Following various guides, I've got to the point where bluetoothctl reports the devices as follows:

    [bluetooth]# info F1:41:42:B4:0D:3B
    Device F1:41:42:B4:0D:3B
    	Name: Puck.js 0d3b
    	Alias: Puck.js 0d3b
    	Paired: yes
    	Trusted: yes
    	Blocked: no
    	Connected: yes
    	LegacyPairing: no
    	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    	UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
    	UUID: Vendor specific           (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
    

    You can see it is both connected and paired and that it has a HID UUID - but I see no new keyboard events when I hit the button.

    Question #1 - has anyone get the HID Keyboard stuff to work with a Pi (in this instance, a Pi3 and its onboard bluetooth).

    I've also tried EspruinoHub and doing something hacky around NRF.setServices() and overloading the 'temperature' value, but in some quick experiments I couldn't get that to work - the value would never change.

    Question #2 - Is there a better approach I should be using going down the EspruinoHub route?

About

Avatar for knolleary @knolleary started