OpenSesame
Rapunzel Code Editor
DataMatrix
Support forum
Python Tutorials
MindProbe
Supported by

Joystick and gamepad

Joysticks and gamepads are supported through the joystick plugin.

instance joystick

If you insert the joystick plugin at the start of your experiment, a joystick object automatically becomes part of the experiment object and can be used within an inline_script item as joystick.

flush()

Clears all pending input, not limited to the joystick.

Returns

  • True if joyinput was pending (i.e., if there was something to flush) and False otherwise.

get_joyaxes(timeout=None)

Waits for joystick axes movement.

Parameters

  • timeout: A timeout value in milliseconds or None to use default timeout.

Returns

  • A (position, timestamp) tuple. position is None if a timeout occurs. Otherwise, position is an (x, y, z) tuple.

get_joyballs(timeout=None)

Waits for joystick trackball movement.

Parameters

  • timeout: A timeout value in milliseconds or None to use default timeout.

Returns

  • A (position, timestamp) tuple. The position is None if a timeout occurs.

get_joybutton(joybuttonlist=None, timeout=None)

Collects joystick button input.

Parameters

  • joybuttonlist: A list of buttons that are accepted or None to default joybuttonlist.
  • timeout: A timeout value in milliseconds or None to use default timeout.

Returns

  • A (joybutton, timestamp) tuple. The joybutton is None if a timeout occurs.

get_joyhats(timeout=None)

Waits for joystick hat movement.

Parameters

  • timeout: A timeout value in milliseconds or None to use default timeout.

Returns

  • A (position, timestamp) tuple. position is None if a timeout occurs. Otherwise, position is an (x, y) tuple.

get_joyinput(joybuttonlist=None, timeout=None)

Waits for any joystick input (buttons, axes, hats or balls).

Parameters

  • joybuttonlist: A list of buttons that are accepted or None to default joybuttonlist.
  • timeout: A timeout value in milliseconds or None to use default timeout.

Returns

  • A (event, value, timestamp) tuple. The value is None if a timeout occurs. event is one of None, 'joybuttonpress', 'joyballmotion', 'joyaxismotion', or 'joyhatmotion'

input_options()

Generates a list with the number of available buttons, axes, balls and hats.

Returns

  • A list with number of inputs as: [buttons, axes, balls, hats].

set_joybuttonlist(joybuttonlist=None)

Sets a list of accepted buttons.

Parameters

  • joybuttonlist: A list of buttons that are accepted or None to accept all buttons.

set_timeout(timeout=None)

Sets a timeout.

Parameters

  • timeout: A timeout value in milliseconds or None for no timeout.
Supported by