Bluetooth Music Controller

In this video I show you how to set up Puck.js to control your mobile phone's music playback by pressing it in different ways.

It uses Puck.js's Bluetooth LE HID capability.

You could extend this relatively easily - for instance:

  • Detection of more types of clicks (eg. > 1 second)
  • Soldering more buttons directly to Puck.js
  • Soldering wires for external buttons (perhaps unused buttons that are in your car's dashboard)

Software

The code used in the video is:

var controls = require("ble_hid_controls");
NRF.setServices(undefined, { hid : controls.report });

setWatch(function(e) {
  var len = e.time - e.lastTime;
  if (len > 0.3) {
    controls.next();
    digitalPulse(LED1,1,100);
  } else {
    controls.playpause();
    digitalPulse(LED2,1,100);
  }
}, BTN, { edge:"falling",repeat:true,debounce:50});

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.