8x16 LED Matrix Pong Game (2 Paddles Per Player Version)
by botdemy in Circuits > Arduino
4557 Views, 2 Favorites, 0 Comments
8x16 LED Matrix Pong Game (2 Paddles Per Player Version)
I have been inspired by many variations of the classic Pong game implemented on Arduino utilizing an 8x8 LED matrix. In this instructable, I will show you how to build my favorite Pong version which has two paddles - striker and goalie - per player. Since an 8x8 LED matrix has very limited spaces (or dots), I will be using 8x16 LED matrix instead on this project. To simply wiring, I will be using two 8x8 LED matrix with built-in MAX7219 and a single potentiometer per player for paddle control.
Materials
- Arduino Uno or equivalent
- (2) 8x8 LED matrix with MAX7219
- (2) 10K potentiometer
- jumper wires
- 9v battery holder & 9v battery
- enclosure (My default solution is always a cardboard box)
Tools: glue gun, knife
Hardware Assembly
Refer to my video and wiring diagram for hardware assembly.
Code
Attached is the Arduino code I used for the game shown on the video.
For this project, I am using a simple max7219 library called LedControl. If you don't have this library installed already on your Arduino IDE, please follow the instructions on their webpage for download and install.
To track ball movement, I'm using 5 variables. While it's better to store all that into an array in case I want multiple balls for playing breakout, this project is designed for middle school students so I'm keeping this simple.
For positioning players, I'm reading respective potentiometers that return values between 0 and 1023 and map them to values between 0 and 7 for Y coordinate.
Using this platform, you can also code other games such as snake, driving, shooting, and breakout. I wrote a two player breakout game with two balls moving simultaneously but due to low resolution and balls are always moving in 45 degree, it didn't work as nice as I imagine it to be. (If you google, you could find a single player breakout game.)