Knowledge Base

Buttons

output-onlinepngtools__231_.png  These blocks work for EV3 Robot!  

The EV3 brick has 6 different buttons (Up, Down, Left, Right, Enter, Escape) which are used for:

  • Navigation within the brick's menu - while no program is running
  • As touch sensors, while a program is running

In CoderZ we have three blocks related to Buttons, located in the Sensors category. These blocks are only relevant for when using a real robot.

1. Button.waitForAnyPress

This block pauses the progress of the program until any of the six buttons is pressed. It is useful to place this block at the beginning of a program so you can start the program by pressing any button.

Like this:

 

2. getButton

This block pauses the progress of the program until a specific button (Choose using  the Enter dropdown) is either pressed, or pressed and released (Choose using the waitForPress dropdown).

Like this:

 

3.getButton.isPressed

This block returns a boolean value (TRUE or FALSE), depending on the button state; pressed or released. You can use it as a condition for Loops and Ifs.

Like this:

 

Was this article helpful?
0 out of 0 found this helpful

Comments

Please sign in to leave a comment.