Our first assignment was to create a controller for a game created by our instructor Tom Igoe. Tom’s game uses processing and allows network-connected devices to establish a link and issue commands. I chose to use what I had available and borrowed a MKR1000 as the micro-computer/wi-fi connector.
The game itself is fairly simple: balls drop from the top of the screen, and players using their controllers move a bar around hoping to prevent the balls from hitting the bottom of the screen. Each time the ball bounces on a players bar, a point is awarded to the entire group.
What I had on hand were a series of slide potentiometers that I needed for a previous project. This allowed me to create a controller that registered the position of the sliders to determine the speed of the bar. One slider could be oriented left-right and one slider could be oriented up-down. Move a slider slightly away from the center and the bar would move in the same direction slowly. Move the slider towards the extremities, and the bar would move quickly.
The controller issues commands by sending characters to the game. I set up a series of ‘for’ loops that add characters to the command based on the location of the slider. If the left-right slider was far to the left, the Arduino sketch would send a command comprising multiple “l”s. If it was only slightly to the left, the Arduino sketch would send only a single “l”. See the sketch below.
Afterward, I crafted a simple enclosure out of some spare cardboard I had lying around in order to keep the sliders from getting mixed up. I then added some text to the control panel to give it some punch! This controller is ready to block some balls!