12. API - Joystick

The joystick on the Sense HAT is an excellent tool for providing a user interface on Pis without an attached keyboard. The SenseStick class provides several different paradigms for programming such an interface:

  • At its simplest, you can poll the state of the joystick with various attributes like SenseStick.up.
  • You can use event-driven programming by assigning handlers to attributes like SenseStick.when_up.
  • You can also treat the joystick like an iterable and write transformations the convert events into other useful outputs.

12.1. SenseStick

12.2. StickEvent

12.3. Warnings