DocumentationHelp CenterDocumentation
Read whether button on EV3 brick is being pressed
result = readButton(myev3,button)
example
result= readButton(myev3,button)reads whether a specific button on the EV3 is being pressed, and returns the status as a logical value:
result= readButton(myev3,button)
result
myev3
button
0means not pressed.
0
1means pressed.
1
collapse all
Read the status of the center button on an EV3 brick.
Create a connection to the EV3 brick calledmyev3.
myev3 = legoev3;
Hold down the center button on the EV3 and read the status of the button.
result = readButton(myev3,'center')
result = 1
Release the center button on the EV3 and read the status of the button.
result = 0
Connection to EV3 brick, specified as a string that represents the object created usinglegoev3.
legoev3
Example:myev3
Data Types:char
char
up
down
left
right
center
Position of the button.
Example:'up'
'up'
The status of the button, returned as a logical value.0indicates not pressed.1indicates pressed.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office