The latest issue of Computeractive magazine features the last portion of my three-part series looking at practical projects for the Raspberry Pi, and this one is a doozy: it involves getting your soldering iron out.
Going beyond the material originally prepared for my book, the Raspberry Pi User Guide, this latest feature takes some stripboard, switches, wiring and resistors and creates a fully-functional four-way game controller which connects directly to the Raspberry Pi’s general purpose input output (GPIO) header.
The Snake game, created for the book and featured in last issue’s tutorial on writing games using Python and the pygame library, is modified to understand both keyboard and GPIO-driven gamepad input. It’s a lot to ask of Computeractive’s readership, most of whom have probably never picked up a soldering iron before, but I’m hopeful that a few will be tempted to try it out – and made sure there were plenty of diagrams available to make things as clear as possible.
For those who want to take the project further, there are still spare GPIO pins on the Pi – meaning it’s perfectly possible to add a fire button or two for controlling a more complex game. If programming is more your thing, the fact that the code is modified to monitor both keyboard and GPIO input means it’s fairly straightforward to add a second player to the game – creating a simple version of the Tron lightcycle game.
Computeractive Issue 383 is available pretty much anywhere magazines are normally found, or online through Computeractive Direct.