Documentation Center

  • Trials
  • Product Updates

Contents

LEGO MINDSTORMS NXT Button

Output state of button on NXT brick

Library

Simulink Support Package for LEGO MINDSTORMS NXT Hardware

Description

Get the state of the "middle orange" or "right arrow" button on the NXT brick: 1 while pressed and 0 while released.

If you run a simulation of a model that contains this block without the target hardware, this block outputs zeroes. See Block Produces Zeros or Does Nothing in Simulation.

Use the Button

Measure the voltage of the batteries in the NXT brick.

Open the legonxtlib block library and copy the blocks shown to a new model.

Connect the Button block to the LCD block, as shown.

Prepare and run the model on the NXT brick.

Press the orange button on the NXT brick, and observe 0 on the LCD display turn to 1.

Dialog Box

Button

Select the button for which to output status. The options are Middle orange and Right arrow.

Sample time

Specify how often the block reads the state of the button.

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

See Also

| | | | | |

External Web Sites

Was this topic helpful?