Arduino: Joysticks

A joystick is just two analog potentiometers, so you can move in two different directions, X and Y, at once. Just like a potentiometer, you wire one side to 5v, the other to ground, then you use analogRead to read the input. You can use the same code you used for the potentiometer -- the only difference is that you have two potentiometers wired up instead of just one.

[basic analog joystick] Some joysticks also include a pushbutton.

We have two kinds of joysticks. They look a little different but they both work the same way. Both of them plug into your breadboard so you can access the inputs and outputs.

One type has pins for Vcc (wire that to 5v) and Gnd.

The outputs are Xout and Yout (connect those to the analog pins you're going to read).

It also includes a pushbutton: use Sel if you want to read whether the user has pushed down on the joystick.

[Parallax joystick] The Parallax joysticks look a little more complicated, but they work the same way, except they don't have a pushbutton.

Gnd is ground -- there are two Gnds, but you only need to use one of them (they're wired together).

L/R+ and U/D+ both get wired to 5v -- they're like Vcc on the other joystick.

L/R and U/D are where you read X and Y outputs. There are two of each, but they're the same -- it doesn't matter which one you wire up, so use whichever is easiest for you to reach with the wire.