Joystick
Background

The joystick allows you accurate control for your projects. It is comprised of two potentiometers and a pushbutton. One potentiometer is used for the X position while the other is used for the Y position. The pushbutton is activated when it is clicked in for selection.
Hardware Description
Pinout
- GND - Ground connection
- +5V - 5V connection
- VRx - analog voltage value between 0V and 5V giving you the relative x position
- VRy - analog voltage value between 0V and 5V giving you the relative x position
- SW - pushbutton switch, click in to press
Software Description
- Use analogRead() to determine the x and y position of the joystick.
- Remember: analogRead() returns a value between 0-1023
- The midpoint is ~512.
- Use digitalRead() to determine whether or not the switch is pressed.
- Configure pin like so: pinMode(SW, INPUT_PULLUP)
- Switch is pressed when digitalRead(SW) == LOW