To receive by Christmas (US orders only):
3-Day shipping – order by 12/19 12pm est
Overnight shipping – order by 12/22 11:59p est
Play Pong on your computer screen using two analog sensor modules as inputs. This sketch will allow you to send two analog sensor values from the Arduino module to a Processing sketch that is running a version of the game Pong. The Pong paddle positions move based on the sensor values in this two player game. For more “getting started” sketches, click here. To learn more about coding, find examples on Arduino’s website.
Play Pong on your computer screen using two analog sensor modules as inputs.
This sketch will allow you to send two analog sensor values from the Arduino module to a Processing sketch that is running a version of the game Pong. The Pong paddle positions move based on the sensor values in this two player game.
For more “getting started” sketches, click here.
To learn more about coding, find examples on Arduino’s website.
Install the software
Before connecting the Arduino module to your computer, download the Arduino software from arduino.cc (it's free!).
If you're using Windows, double-click the installer you just downloaded to install the Arduino software. Proceed through the installation process. Now, navigate to the following folder on your computer:
C:\Program Files (x86)\Arduino\drivers
Double-click on "dpinst-x86.exe" or "dpinst-amd64.exe" depending on if you have a 32-bit or 64-bit version of Windows respectively. This application will install drivers for your Arduino to communicate with your computer.
If you're running the Mac OS, unzip the downloaded file and move the Arduino application to your "Applications" folder to install the Arduino software.
You will also need to download the Processing software from processing.org (also free!).
If you're using Windows, unzip the downloaded file. This will provide you with a folder with a name like "processing-2.2.1". Inside this folder is a file named "processing.exe". This is your Processing application.
If you're using the Mac OS, unzip the downloaded file and move the Processing application to your "Applications" folder to install the Processing software.
Download the sketches
Above in the "Other files" section of this project are two files. Downloaded these files. "Analog Pong - Arduino" is the sketch for your Arduino module and "Analog Pong - Processing" is a collection of files that make up your sketch for the desktop software written in Processing.
First, download "Analog Pong - Arduino". This will provide you with a single file named "analog_pong_arduino.ino". Double-click this file and Arduino should open and prompt you asking to move this sketch to its own project folder, click OK. The Arduino software should now be on your screen displaying the pong sketch for your Arduino module.
Second, download "Analog Pong - Processing". This will provide you with a zip archive named "analog_pong_processing.zip". Unzip this archive. Return to the location of your Processing application and run it. Go to the menu at the top and click File > Open... Navigate to the location of your Processing sketch folder "analog_pong_processing" then select "analog_pong_processing.pde" and click Open.
You should now have both your Arduino software open with the Arduino Pong sketch and the Processing software open with the Processing Pong sketch.
Build your circuit (see the photo gallery for an image of the setup). Make sure your two dimmers are connected to the analog input pins, A1 and A0.
Plug the micro USB cable into both the Arduino module and a USB port on your computer.
Turn your power module on. You should see a red light illuminate on the power module and a yellow light flash on your Arduino module.
In the Arduino program, select your board. Go to Tools > Board > Arduino Leonardo. This littleBits Arduino module is modeled after the Arduino Leonardo and is therefore compatible.
Next select the serial port that the Arduino will communicate over by going back to "Tools" and selecting the correct port in the "Port" section. The name of the port will depend if you are on a Mac or Windows computer. On a Mac, it will start with /dev/tty.usbmodem... and a PC will start with COM… In Windows, you can look for the USB serial device in the ports section of the Windows Device Manager. If you are on a Linux machine, the port will look like /dev/ttyUSB…
To upload the Arduino sketch to your Arduino module, press the arrow button in the top left corner of the screen. You will see a blue bar at the bottom of the window that says "Compiling sketch..." followed by "Uploading...", and you should see two yellow lights flash on your Arduino module when this happens. The upload is complete when you see "Done uploading" at the bottom of your sketch window.
Now, switch over to the Processing sketch. Press the "Play" button in the Processing window at the top-left corner. This will open another window that says "littleBits PONG". Press any key on your keyboard to start the game and move the dimmers to adjust the Pong paddles.
If you are unable to move your Pong paddles, you may need to make a slight adjustment to the code in the Processing sketch so that you connect to the correct serial port.
Scroll down until you find this line of code:
myPort = new Serial(this, Serial.list(), 9600);
You will need to replace the 0 in Serial.list(). Start counting up from 0. After each change you make, try and run the game. Each time you change this number you are essentially selecting a new serial port to communicate with.
You can also save big by getting all these bits and more in this kit:
Add this collection to get these modules and more for a price savings