Go Down

Topic: How to interface with a joystick? (Read 601 times) previous topic - next topic

Chicken325

I have this joystick here and I would like to use it. (That's what I got it for!  :))  I've connected both GND pins to the ground, but I don't know what's next, or how to listen to it with code.  Could you help me? Thanks!

Olnk

From the link you provided:

'Our 2-Axis Joystick can be used to add analog input to your next project. The 2-Axis Joystick contains two independent potentiometers (one per axis) for reporting the joystick's position, with wiring options for voltage or resistance outputs'

So you'll have to read those two potentiometers to get the x and y of the joystick. Take a look at http://arduino.cc/en/Tutorial/AnalogReadSerial for a tutorial on reading potentiometers.

About the wiring: connecting the ground pins to GND is ok, the description of the joystick says the potentiometer have a common ground, so connecting just one of the ground pins to GND should suffice. Furthermore you'll have to connect the 'other end' of the potentiometers to +5V. The other ends are marked L/R+ and U/D+ in the schematics (also on the link). Finally you'll have to connect each 'output' of the potentiometers to an input of your Arduino. The outputs are marked L/R and U/D and the input pins depend on your sketch. (its A0 in the example.)

Hope this helps!

Olaf


Chicken325

Worked perfectly.  Thanks so much!

Go Up