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. 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.

If anybody would like to see the code/files, just speak up. I don’t want to confuse people by giving them messy code, which is why I’m not putting them up now. If people are interested, I will go through and clean it up.


i have to say: thats awesome! :slight_smile: great work!

Yeah, that’s really a good job on the controller - I think I like the wood. Great job!