Falling Blocks on Raspberry-Pi
With some of my
ECE471 Embedded Systems students making video games for
their final projects, I thought I'd do one too just to make sure the
hardware was up to it.
I made a Tetris-like game using two 8x8 displays (for the field),
a 7-segment display (lines cleared and next piece) and a Wii-Nunchuck,
all on the same i2c bus. The parts are all leftovers from a pile of
i2c parts we got from adafruit for students to use in projects. The
displays use the ht16k33 i2c LED driver.
The game is mostly there, though still a bit buggy. Piece movement is
done doing the accelerometer (not the joystick) which is fun but a bit
hard to maneuver at times.
Some video. See if you can spot the typo, and I apologize in advance for
the shaky camera.
The source code can be found here:
Under the nunchuck directory.
The code should work on any version of Linux. It expects the 8x8 displays
at 0x70 and 0x71, the 4x7 at 0x72, and the nunchuck at 0x52.
If you don't have i2c
displays hooked up it will automatically fall back to the console
ascii/ansi/keyboard mode used for debugging:
As seen on Hack-a-day, 14 December 2013
Back to VMW Hardware Productions