Pages: [1]   Go Down
Author Topic: How to interface with a joystick?  (Read 511 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have this joystick here and I would like to use it. (That's what I got it for!  smiley)  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!
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Worked perfectly.  Thanks so much!
Logged

Pages: [1]   Go Up
Jump to: