Datasheet
Reading the Joystick
The 5-way joystick on the shield is great for implementing menu navigation or even for use as a tiny game controller.
To minimize the number of pins required, the joystick uses a different resistor on each leg of the control to create a
variable voltage divider that can be monitored with a single analog pin. Each movement of the joystick control
connects a different resistor and results in a different voltage reading.
In the code example below, the CheckJoystick() function reads the analog pin and compares the result with 5 different
ranges to determine which (if any) direction the stick has been moved. If you upload this to your Arduino and open the
Serial Monitor, you will see the current joystick state printed to the screen.
© Adafruit Industries https://learn.adafruit.com/1-8-tft-display Page 29 of 36










