Flick is a range of add-on boards for the Raspberry Pi, bringing 3D tracking and gesture control in various form factors. These gestures can be associated with specific commands, offering an entire new way of controlling devices.
This guide was originally published here.
In this guide, we’ll cover the control of the JustBoom Player using gestures with Flick and REST.
PrerequisitesFor this project, you will need:
- One Raspberry Pi with JustBoom pHAT or HAT, and the official JustBoom Player installed
- One Raspberry Pi with Flick board, and Flick software installed
Both Raspberry Pi should be connected to the same (wireless) network, and will interface via REST.
For more information on setting up the JustBoom Player or getting started with Flick, please refer to following guides:
Remote ControlThe JustBoom Player, based on Volumio, can be controlled via its REST API. This API makes it possible for any device to control the player using specific URLs.
The full REST API is documented on the Volumio website.
Using Python, it is possible to combine the Flick library with this REST API, associating gestures with commands such as “play”, “pause”, etc.
REST in Python
Below is an example function of how to tackle REST calls in Python, with some checks for connection issues or unexpected responses:
With the REST calls available in a simple function, it’s a small task to combine it with the existing Flick demo code.
Upload the code to your Pi using scp and give it the necessary permissions:
scp flick-justboom-rest.py pi@raspberrypi.local:Flick/bin/
sudo chmod +x /home/pi/Flick/bin/flick-justboom-rest.py
Run the script, you are ready to try it out!
/home/pi/Flick/bin/flick-justboom.py
Demo
Comments
Please log in or sign up to comment.