I’ve shown you how to use shift registers to drive an LED grid, including how to draw pictures on the screen from memory. Now we’re going to use those tools to make a game similar to the classic Tetris. I’ll show you the circuit, how to draw pieces, how to create animations, respond to user input, and more. Learning how to build complex behavior from simple parts is a great start to thinking about how robots behave.
I used the Arduino Starter Kit tutorials for building your own game of Tetris and modified them just enough to run the game with WS2811 full color LEDs.
For added authenticity I added wall kicks (turning a piece close to the edge pushes it away from the edge) and increasing difficulty (finish a row, game gets faster).
You can grab the code from the LED8x16tetris github repository I just pushed.
You can try the game live June 6-7 at the Vancouver Mini Maker Faire at the PNE fairground in Vancouver, BC, Canada. We’ll have stuff you can build, stuff you can buy, stuff you can play, and smiles for everybody. It should be a beautiful weekend, so come on out and make the most of it.