Tuesday, 1 December 2015

Raspberry Pi Advent Calendar with SenseHAT

We missed out on a Lego Advent calendar this year so I decided to code up one for the Pi and the SenseHat.



The top 6 rows of the LED matrix are used to show the days on the month, each one being represented by 2 LEDs . Every day a new pair of LEDs illuminates and you can then select them using the joystick to navigate (your cursor is a pair of bright red LEDs). Pressing the joystick as a button will then display the day number followed by a Christmas image or animation created by my son Ozzy.





To make it funky, each day the grid redraws itself with different coloured LEDs in each position.

Everything you need is in this Github repo. Clone it and then run advent.py

Because the images are just 8x8 bit, they can take a little bit of imagination to work out (the Dec 1st is a snowball fight, before you ask!). You can, of course use your own content for each day. The static pictures should go in the pngs folder: name them decx.png, where x is the day. Animations should be added as a list of frames to animations.py  (follow the format of the existing ones).




You can use my 8x8grid drawing program to create your images and animations.

I wrote this in a bit of a rush so let me know if you spot any bugs surprise features!

3 comments:

  1. This is awesome! Please consider sharing in our idea campaign “What would you build with the new Raspberry Pi Zero?” http://app.theinnovationloop.com/coach/campaigns/what-would-you-build-with-the-new-raspberry-pi-zero-for-dollar5/brief

    ReplyDelete
  2. Hi Richard--
    This is so great! Thanks for sharing-- I got the program up and running no problem.
    Quick q (and maybe I just can't figure this out because I'm still a bit of a newb...)-- for some reason Python & the Pygame window freeze up when I try to stop this program. The program itself seems to stop (according to msg in shell window) but the actual Python & Pygame windows remain frozen on my screen.
    Tried on 2 different Pis and had same effect. Have you have this problem at all?

    ReplyDelete