Skip to content

Joystick — direction / push (boolean) (get_joy_state_ble)

What it does: Returns a boolean based on the selected direction (up, down, left, right) or joystick button pressed.

get_joy_state

Inputs

  • Field joy_name: joystick selection (joystick 1/2 or Bluetooth virtual left/right).
  • Field axis: direction or option pressed.

Output

  • Boolean (True/False).

When to use it

  • For event control without having to manually compare axis values.
  • When you want simple logic like "is the joystick on the right?"

Tips and pitfalls

  • For directions, the implementation uses thresholds of approximately ±40.
  • For fine axis control, use the get_joy_axis_ble block.

Usage example

example_joy_state

Open example in ESP IDE

Generated Python example

pressed = joystick1.joy_check(5)