I've built on the PuckJS media controller, to add some functionality. I've published it to a github repo and thought I'd share my progress. It will do different things, based on the click duration and orientation of the device.
disconnect: click and hold, > 2 seconds
connect to last device: click < 2 seconds when disconnected
connect to PC's bluetooth ID (for updating firmware, etc): click > 2 seconds when disconnected
play/pause: short click
next track: longer click, right-side-up
prev track: longer click, upside-down
volume up: click and hold while rotating from upside-down to right-side-up
volume down: click and hold while rotating from upside-down to right-side-up
My original intention was to use the puck's axial rotation (think rolling the puck along a surface while pinching between finger and thumb), but couldn't determine whether the device was moving clockwise or counter-clockwise. This means that you'll need to use radial half-rotations to control volume one increment/decrement at a time.
This is mostly a test of how to incorporate the puck's sensors into a usable UI in its most minimal form. Hope others find something useful here!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I've built on the PuckJS media controller, to add some functionality. I've published it to a github repo and thought I'd share my progress. It will do different things, based on the click duration and orientation of the device.
https://github.com/jptrsn/Puck-JS/blob/master/media_control.js
disconnect: click and hold, > 2 seconds
connect to last device: click < 2 seconds when disconnected
connect to PC's bluetooth ID (for updating firmware, etc): click > 2 seconds when disconnected
play/pause: short click
next track: longer click, right-side-up
prev track: longer click, upside-down
volume up: click and hold while rotating from upside-down to right-side-up
volume down: click and hold while rotating from upside-down to right-side-up
My original intention was to use the puck's axial rotation (think rolling the puck along a surface while pinching between finger and thumb), but couldn't determine whether the device was moving clockwise or counter-clockwise. This means that you'll need to use radial half-rotations to control volume one increment/decrement at a time.
This is mostly a test of how to incorporate the puck's sensors into a usable UI in its most minimal form. Hope others find something useful here!