Button

Detect button press on EV3 brick

Library

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware

Description

Detect whether a specific the EV3 Brick Button is being pressed:

  • 0 = Not pressed

  • 1 = Pressed

You can configure the block to detect the Center, Left, Right, Up, or Down button.

You cannot configure the block to detect the Back button because the EV3 brick reserves the Back button for stopping programs and shutting down.

The block output emits values as uint8.

During simulations without hardware, this block emits zeros. See Block Produces Zeros or Does Nothing in Simulation (Simulink).

Parameters

Button

Select one of the EV3 Brick Buttons: Center, Left, Right, Up, or Down.

Sample time

Specify how often the block reads the state of the button. The default value is 0.1.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

See Also