Python code for GPIO Xmas Tree

Using your tree with newer RPi models

You may notice that the sample code doesn’t work with the newer Pi models (because it has problems detecting what model they are). For a quick fix, the easiest thing to do is change one line in the file

If you are using a Pi with 40 GPIO pins then change the line:

     if ((revision == “0010”) or (revision == “0012”)):


     if (True):

And you can put False if you are using a 26-pin Pi.


You can download the code here

On a Raspberry Pi you should be able to download the code using:


Extract the zip file:


You can then run an example with:

   cd xmas

   sudo python

You can see more information by typing:

   more README.txt



Run a game on your tree

If you didn’t see it last year, do check out Martin O’Hanlon’s excellent Xmas Tree Reaction Game