Skip to content

rbtrrnss/Puck.js-volume-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Puck.js-volume-control

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

Demo

demo

Based on :

Espruino YT channel - DIY Hands-free music control with Puck.js This is how I initially found out about the Puck.js. The corresponding code for the video can be found here.

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.

How to use it:

Just transfer the code in code.js via Espruinos Web IDE and web BLE in Chrome to your Puck.js and pair with a phone/computer.

About

Simple js code to run on the Puck.js to control playback and volume of a media device (phone/PC)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published