This PS2 joystick is has three different analog sensors to give you great control over your creations. There are also built in springs to return the joystick to center position when released.
One sensor is an analog potentiometer reading up/down movement, one to sense left/right movement, and one is a digital momentary switch button to sense clicking (pressing the stick in towards the center).
Analog sensors connected to analog pins on arduino can be read with
analogRead() and return a value between 0 and 1023, inclusive, where 0 is pushed all the way to one side and 1023 all the way to the other. When released the joystick will center and return a value close to 512.