Here's a simple project that you can do to get acquainted with the TVOut Library, and using an Arduino with RCA Jack outputs! Pong is a classic. The foundations of video gaming start with two lines and a dot bouncing back and forth on a black screen. The Atmega328 is leaps and bounds more powerful than the original pong system (which was either quite a lot of transistors, or a chip with less power than a dollar store calculator), and we'll have no problem making a pong clone with arduino. If you want to make your own game with arduino, this is a cool place to start. Let's make Pong!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Project Parts List:
You can build this with different parts, these are just the suggested ones for simplicity. Don't skip the Sensor Shield, it will save you loads of time, allowing you to skip breadboarding. Our wiring diagram will assume you're using the sensor shield. If you don't want sound, you can skip the Y cable and 2 of the RCA boards.
- 1 x Geekduino or other Arduino UNO / Duemilanove equivalent
- 1 x Sensor Shield for easy wiring
- 1 x RobotGeek Duino Mount
- 1 x RobotGeek Small Workbench
- 1 x RobotGeek Pushbutton
- 2 x RobotGeek Rotation Knob
- 3 x RobotGeek RCA Board
- 1 x Sensor Y Cable
- 1 x 6V Power Supply
- 1 x RCA (Yellow Red and White terminated ends) Cable
- 1 x Huge Ancient CRT Screen Television
- 1 x Childlike sense of wonder
Step 2: Wiring
Follow the diagram to make your TVOut Console. Watch your jumpers, make sure they're set to 5V or you could destroy not only the RCA boards, but the input on your television.
|Device||Sensor Shield Port|
| Right Player Control ||Analog 0|
| Left Player Control ||Analog 1|
| Start Button ||Digital 2|
| Sync ||Digital 7|
| Video ||Digital 9|
| Audio Left Channel (on video pins) ||Digital 11|
| Audio Right Channel (on video pins) ||Digital 11|
Step 3: Programming
Grab the RobotGeek Libraries and Tools from Github, and extract it to your arduino folder.
File → Examples → TVOut → PongNTSCand upload it to your arduino.
You're ready to play some pong! This program utilizes the TVout library, which handles drawing shapes, text, and bitmaps to the screen. It is a completely interrupt driven library that will output either NTSC or PAL composite. Pong isn't the only game designed using the TVout library! If you check out Nootropic Design, there are a good handful of games made, and they have a section devoted to helping you design your own! This makes for some great jumping off points on an adventure into making your own video games!
Step 4: Play!
So you might notice that the game isn't particularly challenging. Can you find out where the ball speed is in the code? What would happen if you changed the paddle size? Those sounds are kind of annoying, and there's no music. Could you use the TV.tone function to change that? What about changing the message that appears on screen at game over? Play around with the code and see what you can make happen!