PyPong

Pong video game using Atmega8 Microcontroller, and Pygame

 MyAVR development board with many integrated components. One of the potentiometers controls position of the rocket on the screen.


Pong screen. Only one rocket, one ball, and four walls.

 

Video (3gp format) of the game.

I've spent two evenings and I've done it! The hardest thing was soldering despite the fact, that I never had dealings with microcontrollers before. I've found AVR Atmega8 microcontroller the cheapest option to create the simplest pong controller. It is probably also the fastest way.

How it works 

ADC on the microcontroller measures resistance on potentiometer and sends this info through the serial line to PC. C source is to compile with avr-gcc. I also use avrdude to load byte code into the flash memory of a microcontroller.

Pong code is running on the PC. It reads constantly bytes on the serial port, changing positions of the objects on the screen. It requires python and pygame to be installed.

Source code

C source and Makefile to build byte code for microcontroller
pong.mpu.tar.bz2 

Pong source and a python module to use serial port directly from a python application
pong.cpu.tar.bz2