This uses the amazing Puck.js (v2) to control media playback and volume via BLE media control.
It translates physical rotation of the Puck into a change in device volume.
What this does:
- Short press: play/pause
- Long press: CW rotation --> increase volume, CCW rotation --> decrease volume
Based on :
Aaron McBride YT channel - Puck.js Volume Knob Sadly, there was no documentation given on how this was achieved.
How it works:
The magnetometer of the Puck.js is read out at a predefined interval, an "azimuthal" heading is calculated and then compared to the previous heading. The difference is used to differentiate between CW and CCW rotation, resulting in a command for increasing/decreasing the volume.
The code might be a bit rough, but this was my first project with this device.