Joystick Hat

The following products are supported:

JoystickHat

class JoystickHat

Constructors

class JoystickHat(i2c, address: int | list | tuple = 0x38)

Create a new instance of the JoystickHat class.

参数:
  • i2c – I2C bus

  • address – I2C address

UIFLOW2:

init.svg

Methods

JoystickHat.get_x_raw() int

Get the raw x-axis value.

返回:

x-axis value

UIFLOW2:

get_x_raw.svg

JoystickHat.get_y_raw() int

Get the raw y-axis value.

返回:

y-axis value

UIFLOW2:

get_y_raw.svg

JoystickHat.get_x() int

Get the x-axis value.

返回:

x-axis value

UIFLOW2:

get_x.svg

JoystickHat.get_y() int

Get the y-axis value.

返回:

y-axis value

UIFLOW2:

get_y.svg

JoystickHat.swap_x(swap: bool = True) None

Swap x-axis direction

参数:

swap – True or False

UIFLOW2:

swap_x.svg

JoystickHat.swap_y(swap: bool = True) None

Swap y-axis direction

参数:

swap – True or False

UIFLOW2:

swap_y.svg

JoystickHat.get_button_status() bool

Get the button status.

返回:

True or False

UIFLOW2:

get_button_status.svg