You are reading a single comment by @user129965 and its replies.
Click here to read the full conversation.
-
Thank you! I have managed to get this to work using magnetometer, modifying it's sensitivity to movement so that it performs different actions, eg: small move - play/pause, big move - next song. Easier than I thought, especially given the base already existing on the forum and the guidance for Puck. Thanks once again :)
Hi! It sounds like you figured out the motion detection bit with https://www.espruino.com/Puck.js#on-board-peripherals ?
So literally all you need to do is mash the two together. For instance using 'Movement detection' from the Puck.js page, and the code from https://www.espruino.com/BLE+Music+Control:
The only trick is making sure you don't call the function too often - so above I only call it the first time it turns the LED on, so you have to wait until the light goes out before you can skip to the next song.
I guess you could look at
acc.z > 0
or something like that so that depending on which way up you help the puck, it played/stopped or skipped song