Custom Game Controller
The game is very simple. You move a laser up and down to shoot targets. Each target has a random number of points which is multiplied by a decimal number between 1-2, depending upon how close you hit to the center. The product of those two numbers is added up to create you final score after one minute. I might later add better graphics and gameplay to the game.
The real focus was the controller and communication. There is a spinning wheel and a button. Spin the wheel to move the laser up or down, and press the button to fire. The spinner is connected to a potentiometer to get the rotation. The fire button is just a simple switch. The switch and potentiometer are read by an Arduino and then sent over a serial connection(USB)
This was the toughest part. I had to make a way that the Arduino could send two separate values and have them read and identified by the computer. I used the pySerial module for Python that allows me to access the data sent through USB. The Arduino sends a constant stream of data, separated by spaces. The python script reads 15 bytes, and finds a full data packet (when it reads data, the first packet is usually only a partial one) It does some manipulation and separates the two values and assigns them to variables; one for whether to fire, and one for the rotation of the laser.