Tuesday, 28 July 2015

Raspberry Pi AstroPi LED matrix animations

When we were investigating the AstroPi board,  I wrote a simple Pygame app for creating images for the LED matrix. Quite a few of the children started using this to produce singles frames to be amalgamated into an animation.  Assembling the animation in this way was good coding practice but some of their complicated compositions were several hundred frames long and manually putting them together was fairly tedious to say the least.

So I decided to enhance my code to add the functionality to create and save animations directly through the app.  This has involved adding some more buttons: 

But essentially it works in the same way as the original, just with the added ability to step back and forward through frames.

After some initial testing, the children suggested (demanded?) some extra features that I hadn't included (e.g. the ability to delete a frame and change the speed of playback).

 I also added a warning message if you try to quit without saving. Pygame's lack of a standard library of GUI tools (e.g. file browse etc) does add some limitations, so the file save/import is always via a file of the same name. Other than that though, it works pretty well.

Here are some examples of animations created using the app.

Space launch:


Union Flag to Raspberry Pi Logo

The code and full instructions is available on GitHub here.

1 comment: