The joystick

The joystick is composed of two potentiometers, which acts a a voltage divider when supplied with 5V. To read the tilt to either X or Y direction, the arduino can read and analog value to determine how far the stick has been tilted. When in the middle, the read input is around 508-519 because of noise in the reading. To determine if the user has been tilted, is when the voltage reads higer than 530 or lower than 450 to compensate for noise.The program reads the two values which is put into Analog 1 and 0. If statements determines which carachters that is set to either A, B, C, D. This is sent to the serial window to debug the behavoiur of the joystick. The code reads X values in first, and then Y, since the sticks needs to move more than 45 degress in another direction for the code to choose another character to send. The code can be put directly into the program to work with the rest of the code to determine which input the user has choosen in the quiz.

Skærmbillede 2014-04-16 kl. 17.18.00

Skriv et svar

Udfyld dine oplysninger nedenfor eller klik på et ikon for at logge ind:

WordPress.com Logo

Du kommenterer med din WordPress.com konto. Log Out /  Skift )

Twitter picture

Du kommenterer med din Twitter konto. Log Out /  Skift )

Facebook photo

Du kommenterer med din Facebook konto. Log Out /  Skift )

Connecting to %s