Vector Pong

From Bloominglabs
Revision as of 12:15, 25 October 2016 by Avh.on1 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Vector Pong is a simple Pong clone built from an Arduino and a 1960's Heathkit oscilloscope. The first version was built in a single night on Friday-Saturday, august 26-27 2016.

For input, the Arduino reads two potentiometers with two of its analog inputs. The potentiometers are built into the simplest "controller" I could build: they are screwed into tongue depressors.

Internally, the Arduino keeps track of where the two paddles are, where the ball is, how fast the ball is moving in the X direction and in the Y direction, and the players' scores. Roughly 60 times per second, the Arduino recalculates the locations and velocities, and generates an array of dots, stored as [X,Y] coordinates. During the intermediate time, the Arduino outputs these [X,Y] pairs sequentially, drawing dots to the screen.

For output, I built two 6-bit [resistor ladders] and attached them to 12 of the Arduino's 14 GPIO pins. These resistor ladders allow the Arduino to produce analog voltage values corresponding to the X and Y coordinates of a dot. The oscilloscope is placed in [X,Y] mode, and its inputs are attached to the resistor ladders' outputs.

Originally, I tried using the Arduino's PWM to generate analog voltages without additional hardware or software. Unfortunately, the Arduino's PWM runs at about 460 Hz, which the oscilloscope is easily able to display. I then tried to implement my own output, with [Pulse-Density Modulation] in a tight loop. Unfortunately, recalculating the densities of the pulses took long enough that the display would stutter. In the end, I spent a couple of hours carefull wiring resistors to 0.1" headers.

Personal tools