Media Controller

Posted 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.­aster/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!

  • Nice - thanks for posting it up!

    It's very cool that you managed to use the magnetometer to detect flipping the Puck over.

    I've got one here that I screwed to a piece of wood (with a screw right in the middle of the case), and then I hid a magnet in the wood. You can then use the magnetometer with Math.atan2 to actually get a rotation value as you turn it - not sure if that'd be useful here?

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

Media Controller

Posted by Avatar for OpenSourceTeacher @OpenSourceTeacher