the size of the ball (15x15 pixels), increments the X and Y
position of the ball with time, causes the ball to reverse
direction on impact with a wall or the paddle, and
communicates with the Arduino. It writes a “1” to the
Arduino if the user is successful in rebounding a red ball,
and changes the color of the ball back to white.
The serialEvent loop looks for a danger or alert
condition from the Arduino, signified by a “ 2.” In the
current configuration, when the voltage across the 220 µF
capacitor drops significantly, the value read by A2 is
eventually “ 2.” The color of the ball and paddle are
changed to red, and the player must hold down the space
bar — or other key — when moving the paddle with the
mouse to intercept the ball.
The subroutines called by the
main program are listed by title only.
The full definitions appear in the
actual source code. There are
subroutines for changing the color of
the ball and paddle, for putting up
the splash screen at first launch and
after each session, and for playing
Taking It from Here
An obvious next step is to
experiment with controlling and
monitoring different devices through
the Pong game interface. A heater
element/thermistor pair would work,
for example. Then, there’s the
extension of the monitoring code to
include sequences and various
scaling functions so that it’s not
simply the decayed signal from an
LED or lamp. The point is to have a
sequence or single value that
requires human attention/decision
making and reflect that in real time
A next step is to increase the
complexity of the game design. Add
levels. Increase the level of difficulty.
Add more interactive elements —
and tie these to actions on the
Are you going to be able to
control a factory assembly line by
playing Pong? Perhaps not. However,
with more advanced game play and
decision logic, just about any level of
control is possible. Furthermore, even
if you aren’t interested in the various
aspects of translational reality,
learning how to use Processing to
move data from the environment
into a computer and back again is a
skill worth learning. NV
50 April 2017
Atari introduced Pong in 1972 as their first arcade game. It
was one of those accidental successes in that it was the
result of a training exercise assigned to Allan Alcorn by the
co-founder of Atari, Nolan Bushnell.
ELEC TRONI CS
www.allelectronics.com Order Toll Free 1-800-826-5432
SPST N.O. PUSHBUTTON
Attractive and functional dome-shaped momentary pushbutton.
0.70" dia. black plastic bezel.
0.45" red plunger. Extends 0.3"
above mounting plane. Threaded
bushing mounts in 0.53" diameter hole.
3. 5" wide. Scales for AC,
DC Volts, DC mA & resistance.
Includes test probes, one 9V
and two AA batteries. Fuse and
CAT# AMT-360 $1095 each
Test AAA, AA, C, D, 9V
and button cell batteries.
reading meter. Separate
scale for button cells.
24VDC 10A POWER SUPPLY
Mean Well# SP-240-24.
Fan-cooled power supply.
Protection for short circuit,
overload, over voltage,
199mm x 93mm x
50mm. CE, TUV, cULus.
10 for $35.00 each
$3750 each 12 VDC LEDS
50¢each 10 for 45¢ each 100 for 40¢ each
Bright 5mm round LEDs with built-in
resistors for 12Vdc, No external resistor
required. Works well on 4-12Vdc.
Dimmer at lower voltages.
COLOR LENS COLOR CATALOG#
RED Red LED-12R
BLUE Milky-white LED-12BW
WHITE Milky-white LED-12W
GREEN Green LED-12G
WHITE Water-clear LED-12WP
BLUE Water-clear LED-12BP
12 VDC 1 AMP
4' long cord w/ 2.1mm coax
power plug, center positive.
2-COND. WEATHER PACK
CONNECTOR KIT, 12-10 GA
connector, ideal for automotive, marine, racing,
Includes all the parts
necessary for 1 pair of
Requires crimping tool for assembly.
$289 each 10 for $2.60 each 100 for $2.17 each
LED MOTION SENSOR LIGHT
Turns on when it senses movement
and turns off after 90 seconds.
3. 25" x 2.03" diameter. Uses three
AAA batteries (not included).
CAT# MSL-04 $595 each