AVR Infinite Runner

I wanted to make an infinite runner game. But since “software” infinite runners are so mainstream these days and I also had a lot of purple LEDs laying around, I decided to make one in “hardware”.


I created a screen using purple LEDS and for input I used three buttons. Two buttons are used to moving your dot up and down and one is used as a restart button. Everything is controlled using an AVR Atmega8 microcontroller.

The rules are simple: hitting dots head-on is game over, but hitting them with your side is extra points. As you get more points, the game goes faster and faster. After your dot dies, it displays your score with scrolling text.

How I did it

To implement the screen I used 5 rows and 7 columns of purple LEDs. We select a “pixel” of the screen by setting it’s row cathode LOW, while other rows are set to HIGH. Then, if the pixel’s should be lit, we set the column anode HIGH otherwise we keep it LOW. After that, we wait a little so enough light is emmited and do the same for the other pixels. Using this techique, we need 7+5 = 12 pins. If we controlled every LED independently, we would need 7×5=35 pins!

The buttons are implemented in the usual fashion using pull-up resistors.

The whole thing is composed of two boards, one on top of the other, connected with pcb pins. On the top board is the LEDs and the buttons. On the bottom is the Atmega8, a power connector and an In-System Programming header.

The software is written in C for AVR. We update the screen in the main loop of our program and have a timed interrupt for the game loop and input polling.

Here is a video of me playing