Music Control In Your Car Using Puck.js
About the project
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.
Project info
Difficulty: Easy
Platforms: Espruino
Estimated time: 2 hours
License: Apache License 2.0 (Apache-2.0)
Items used in this project
Story
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});
Credits
Espruino
Espruino, Espruino Pico and Puck.js are low-power Microcontrollers that run JavaScript. Espruino is a JavaScript Interpreter for Microcontrollers that is designed to make development quick and easy. The Espruino interpreter is firmware that runs on a variety of different microcontrollers, but we also make Espruino Boards that come with the interpreter pre-installed and are the easiest devices to get started with. However Espruino itself isn't just the interpreter firmware or hardware - there's also the Web IDE, command-line tools, documentation, tutorials, and modules that form a complete solution for embedded software development.
Leave your feedback...