This is the code controlling the leds and the music in our room
There are several libraries needed in order to run the script.
-
The pip installable files are in the
requirements.txt
file. You can install these by runningpython3 -m pip install -r requirements.txt
. -
Some basic dependencies wich are installable with apt on Ubuntu with
sudo apt-get install gcc make build-essential python-dev git scons swig
. -
The library for communication with the leds. A tutorial on how to install the library is found here. The Git library it self here.
Run the app.py
file as sudo
Add a file called <yourAnimation>.py
to the directory /leds/animations
.
The file must import from neopixel import *
This file must also contain 2 functions with the following names and parameters
def init(strip, data):
def update(strip, data):
strip
is the led object on wich the colors can be changed. The data
object stores some informations like the total number of leds. What exactly the stored informations are you can look up in led_main`.py
in the variable led_state
.
Alternatively you can use the blueprints/animationBlueprint.py
file which also contains some helper modules.
The script is run in a Service stored in /etc/systemd/system/led.services