XMAS Pi Fun
I’ve had a few days off over XMAS, so I decided to have a play with my Raspberry Pi and the 3D XMAS Tree from ThePiHut.com.
With my (very) basic Python skills I managed to come up with a way of using a Status Board on one Pi to control the four different light settings on the XMAS Tree, running on another Pi (the “tree-berry”).
(sorry about the camera work, I just shot it on my phone on the floor)
All the source for this is on my GitHub, if you want to see it.
How it works
The “tree-berry” Pi has a Python SocketServer running on it, receiving commands from the client, another Python program running on the other Pi.
The server is very rudimentary. Each light setting was initially written as a separate python script with
different characteristics on how it runs: some have while True:
loops, others just set the lights and
pause
. To save me from figuring out in how to “teardown” each setting and start a new one, I decided to fork
a new process from the server, and then kill it before changing to the next setting. This makes it slow to change, but ensures I clean up before starting another program.
The 2 consoles can be seen side by side here:
There’s a lot I need to learn about Python, but this is only for a few weeks a year ;).