Thursday, April 14, 2011

LED Matrix Pong!

LED Matrix Pong

I'm taking a robotics course this semester and we're learning how to use the Arduino. For our midterm project, my partner and I created a version of pong on two 8x8 LED matrices. Since the Arduino only had a limited number of digital I/O, we used four shift registers to control the two matrices. Additionally, we used a force sensor to control each paddle. Below is the schematic of how we wired everything up. Our wiring became a bit unruly as we put in the last shift register, but we eventually got everything to work.

final-schematic
(click to enlarge)

I mainly worked on the code for the Arduino. The program follows the idea of having a global matrix that represents the board, and then a function that displays the matrix on the actual LED matrices. That code proved to be the hardest because it required messing around with bit shifting to get the refresh rates to be bearable. This is an area of the project that needs the most improvement. As you will see in the video below, the game is quite flicker-y. Besides displaying the matrix, though, the rest of the code was pretty easy to write.

Click here to download the code.


Robotics 2 Midterm Project from sambot on Vimeo.

LED Matrix Pong

Creative Commons License
Arduino LED Matrix Pong by Sam Prestwood and Eddie Lichter is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at sambotblog.blogspot.com.