In the electrical engineering strand at the Governors Institute of Vermont 2014 our challenge was to create a project using an arduino that had an interactive mode and an autonomous mode. Our group decided to remake the classic pong game using the arduino as a controller and the processing 2.2.1 engine as the display on our laptop monitor. The electronics and wiring for the arduino are relatively simple, but the code and process of having arduino communicate with processing was difficult. Our main struggle was figuring out how to set which com port processing should listen to, but after processing began listening to the correct com port the process was much easier.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Creating the Controller
For the Controller our group used an arduino uno, four photocells, 4 10k ohm resistors, various lengths of wire, and 2 breadboards which could be assembled onto a single larger breadboard, but we didn't have any large breadboards available. The four photocells are powered by the 5 volt pin on the arduino and are placed as far apart as possible to avoid interference between signals.
Step 2: Arduino Code
The source code for the controller and pong code originates from:
for our project we modified this code to have four inputs instead of two because our setup utilizes two photocells per player, instead of a single potentiometer per player such as in the original project. The Controller code works both with the one player mode and two player mode of the pong game, and it is fairly straightforward. The code reads the values which are output by the photocells and sends each value by serial communication to the processing engine.
Step 3: Processing and Pong
Again the Source code for the processing side of the pong game can be found at the following URL:
A download for the Processing 2.2.1 can also be found at the following URL:
An explanation of what processing exactly is can also be found at the homepage of the above URL.
Our modifications to the two player processing code were minimal and mostly served to have the pong game listen for four input values instead of the normal two values, otherwise the two player version is a standard pong game. Our single player variation of pong is the two player mode, but with a wall on one side, a single controllable paddle, and a timer at the top to test your ability to survive. The value in the upper left corner of the single player variation is your longest time trial of your current session, and the value in the upper right corner is the length of your current trial. We have experienced issues of the ball getting caught in the wall which have yet to be completely fixed; we would appreciate feedback on possible remedies to this problem.
Step 4: Sources
"Arduino Optical Theremin." Instructables.com. N.p., n.d. Web. 11 July 2014
"Teach Me To Make." Teach Me To Make. N.p., n.d. Web. 11 July 2014.