Controller#
Introduction#
The One Stick Controller features a 4-button layout and a joystick that functions as both an analog input and a pressable button. These inputs allow the robot to detect button presses and joystick movements, enabling interactive and responsive control. Below is a list of all available blocks:
controller button pressed? – Checks if a specific button is currently being pressed.
controller axis position – Returns the position of the joystick along a specified axis.
when controller button – Runs a stack of blocks when a button is pressed or released.
when controller axis is changed – Runs a stack of blocks when the joystick position changes.
controller axis position#
The controller axis position block returns the position of the joystick along a specified axis as an integer from -100 to 100.
(controller axis [1 v] position)
Parameters |
Description |
---|---|
axis |
The axis to return the position of:
|
Example
when started :: hat events
[Move forward when the joystick is moved up.]
forever
if <(controller axis [1 v] position) [math_greater_than v] [0]> then
move [forward v]
else
stop all movement
when controller axis is changed#
The when controller axis is changed block activates the attached stack of blocks when the axis is being changed.
when controller axis [1 v] is changed :: hat events
Parameters |
Description |
---|---|
axis |
The axis to check for change:
|
Example
when controller axis [1 v] is changed :: hat events
[Move forward when the joystick is moved.]
move [forward v] for [50] [mm v] ▶