Skip to content

Joystick — X/Y axis [-100..100] (get_joy_axis_ble)

What it does: Returns the current X or Y axis value for the selected joystick (physical or virtual).

get_joy_axis

Inputs

  • Field joy_name: joystick selection (joystick 1/2 or Bluetooth virtual left/right).
  • Field axis: choice of axis X or Y.

Output

  • Number: axis position in the range of approximately -100% to 100%.

When to use it

  • For motion control, menu or speed/direction control.
  • After initializing the physical joystick via joystick_init or when virtual data is available.

Tips and pitfalls

  • The virtual joystick is truncated in the code to the range -100..100.

Usage example

example_joy

Open example in ESP IDE

Generated Python example

value = joystick1.get_joyX()