Project Requirements

Create a PONG game. The game has three elements: user paddle, ball, and the computer's paddle. The ball should bounce when it hits the paddle. If the ball misses the paddle, the game is over. The user's paddle is controlled by two pushbuttons, and the computer's paddle is controlled automatically by your code.

The game has to be written entirely in AVR assembly, without relying on any of Arduino's built-in library functions.

When sharing your projects on Hackaday, please tag them with "AVR Pong", so we can make a list of all your projects.

Controlling the MAX7219 LED Driver

The MAX7129 is an LED display driver. Each unit can control up to 64 LEDs (8x8), or eight 7-segment displays.  They can be daisy-chained to control multiple panels. They speak SPI, and the protocol works as follows: 

  1. Set the CS pin (10) to LOW
  2. Write a sequence of 2-byte commands over SPI.
    The first command goes to the first segment, the second command goes to to second segment, etc.
  3. Set the CS pin (10) to HIGH

Each command consists of two bytes: the first byte is the number of row to update (1 to 8), and the second byte contains the value for each pixel in the row. 

For instance, sending the value 05 ff will turn on all the LEDs in the 5th row:

The result of sending 05 ff

You can find a complete Arduino code example here:

Note: when working with the physical hardware, you also need to initialize the display, by sending the following sequence of commands: 0f 00 0b 07 0c 01, and you'd also normally want to clean the screen. the setup() function in the example above does exactly that.

Bonus points (some are very challenging):

  1. Add scores. You can display them using another LED Dot Matrix segment, a 7-Segment display or print them to the Serial console.
  2. Add sound.
  3. Make a two-player version (with four buttons)
  4. Implement a Breakout game. Or Tetris.
  5. Use a NTSC TV for display (e.g.