Skip to content

PID-13 Joystick & Button ​

Instance declaration ​

When you add a PID-13 Joystick & Button block to the workspace, the following instance declaration is automatically inserted into the Python code:

python
cheesestick = CheeseStick(0)
pid13 = cheesestick.PID13()

Parameters ​

NameKindDescriptionRange / TypeDefault
indexDropdown optionInstance number (starting from 0)Integer 0 or greater0

Start the joystick ​

Uses the joystick and the buttons.

start

Parameters ​

(none)

Python ​

python
cheesestick = CheeseStick(0)
pid13 = cheesestick.PID13()

pid13.start()

Joystick value ​

The x / y value of the joystick.
Each value ranges from -128 to 127.

joystick

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionAxis to measurex, y-

Python ​

python
cheesestick = CheeseStick(0)
pid13 = cheesestick.PID13()

pid13.joystick('x')

Button input value ​

The input state of the selected button
It outputs 1 if the button is pressed, and 0 if the button is not pressed.

button_input

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionButton namebutton A ('a'), button B ('b')-

Python ​

python
cheesestick = CheeseStick(0)
pid13 = cheesestick.PID13()

pid13.button_input('a')

Was the button clicked? ​

Whether the selected button was clicked
This block returns true only at the moment the selected button is clicked, and false otherwise.

button_click

Parameters ​

NameKindDescriptionRange / TypeDefault
unitDropdown optionButton namebutton A ('a'), button B ('b')-

Python ​

python
cheesestick = CheeseStick(0)
pid13 = cheesestick.PID13()

pid13.button_click('a')