Friday, December 4, 2015

A PONG Game for Christmas

It is getting close to Christmas, and I need to come up with another present for my son.  He always says that when he was a little kid he had wanted a game system, instead he got a real computer.  He had been a programmer for a while so I guess it wasn't a complete waste.  I think it is time to finally get him a computer game.  Looking around I found a couple versions of the original computer 'PONG"  game for the Arduino. 
I chose  the project from 
that looked like it would be easy to port over to the hardware I have on hand.  And of course it would fit in an Altoids tin.
I had an OLED  like the display in my "Canned Frog", but it was two color instead of monochrome.  I had a small TFT display left over from the DL Watt meter project, so decided to use that.

Looking a the schematic, it was very easy to take the board layout from that project and modify it for use for the PONG project.  I was able to remove the Dummy Load and detector components from the board, and move the Arduino Pro Mini and display up towards one end of the board to give room for the two pots I needed for the game controls.  Only other thing was to bring out a pin to connect a small speaker.

After etching the board and installing the components, I started on porting the software to work with the TFT display.  The main advantage of the software I chose, was that it had used the Adafruit graphics library.  I had a compatible library for the TFT display I was using, so it was only took an hour or so to make the necessary changes to use this display.

Main changes was in the resolution of the display, and handling the different colors available to this display.  The OLED display has a clear() function that was used during the draw routine that was not available in the TFT library.  I tried to  replace this with a fillScreen(color) function. Unfortunately this was much too slow and there was a lot of jiter.  Instead of filling the whole screen, I used the fillRectangle(color) function to only clear areas that needed to be redrawn.  This was much faster, and greatly reduced the amount of jitter.  Just a couple of other changes of game play and the porting was finished.
The part of the project that took the longest was cutting and aligning the holes in the Altoids tin.

1 comment:

  1. Was wondering what that silence was all about! Sounds like a lot of fun. Hope your son will enjoy!