Creating a physical game controller with Arduino
Steven Goodwin wrote a JavaScript game called Space Bounce where a character in a space suit has to jump from one side of a mine shaft to another, collecting roughly star-shaped objects, while avoiding spikes. It’s a simple yet rather entertaining game, and since there’s really only one type of interaction (jumping) he decided to make things a bit more interesting by adding a physical controller.
His custom device employs a pair of pressure pads on the ground to sense a player standing on one or the other, and when one’s feet leave the mat, the on-screen player jumps to the opposite wall. Players must then recover and balance on the other mat, and jump back when needed.
An Arduino detects this interaction using the standard Firmata firmware, and a PC running the Johnny-Five library and a Node server passes commands onto the game itself via WebSockets.