Skip to content

Joystick_Lib

Haiqiang Xu edited this page Jun 7, 2018 · 1 revision

This library reads the axis values from the Joystick attached to an analog pin and embedded button attached to digital pin configured as INPUT_PULLUP.

List of functions:

  • ReadAxisX(): returns X coordinate of the joystick. Returns range [0, 255] values with 127 when in idle/center position.
  • ReadAxisY(): returns Y coordinate of the joystick. Returns range [0, 255] values with 127 when in idle/center position.
  • ReadButton(): returns button value of the joystick. LOW when pressed by user and HIGH otherwise.
  • GetDirectionX(): after coordinate X is read, depending its value the direction can be determined as one of the values of enum EDirection: None, Left, Right.
  • GetDirectionY(): after coordinate Y is read, depending its value the direction can be determined as one of the values of enum EDirection: None, Up, Down.
Clone this wiki locally