readJoystick
Read the status of the joystick
Add-On Required: This feature requires the MATLAB Support Package for Raspberry Pi Hardware add-on.
Description
returns the position of the
joystick. The function returns a value between 0 to 5 depending on
the position of the joystick. joystickPress
= readJoystick
(mysh
)
Following are the values returned for the corresponding joystick positions:
0 - Not pressed
1 - Center
2 - Left
3 - Up
4 - Right
5 - Down
The above positions are with respect to the reference position of the Sense HAT. HDMI port of Raspberry Pi facing downwards is the reference position.
returns
‘1’, if the joystick is at the specified position and
returns ‘0’ otherwise. The values you can provide for
button position are: ‘Up’, ‘Down’, ‘Left’,
‘Right’ and ‘Center’.joystickPress
= readJoystick(mysh
,buttonPosition
)
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2016b