Main Content

Button

Display button widget on device screen

  • Library:
  • Simulink Support Package for Android Devices / User Interface

  • Button block

Description

The Button block displays a button widget on the Android™ app. The button has two states: pressed and not-pressed. Tapping the button switches the state of the button. The Button state parameter determines the button state when the Android app starts.

Note

During simulation with no hardware connected, this block does nothing. For more information, see Block Produces Zeros or Does Nothing in Simulation.

Ports

Output

expand all

The block outputs the button state, returned as a Boolean scalar. If the button state is Pressed, the block outputs 1. If the button state is Not Pressed, the block outputs 0.

Data Types: Boolean

Parameters

expand all

Select the initial state of the button when the Android app starts.

Specify a discrete time interval, in seconds, at which the block reads the button state and outputs the data.

Note

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

Version History

Introduced in R2015a