Documentation Center

  • Trial Software
  • Product Updates

Contents

LEGO MINDSTORMS NXT Timer

Measure elapsed time from timer in NXT brick

Library

Simulink Support Package for LEGO MINDSTORMS NXT Hardware

Description

Measure the elapsed time, in milliseconds, from the time the NXT brick starts running the model.

With External mode disabled, the default setting, the NXT brick starts running the model when you press the right-arrow button on the NXT brick. With External mode enabled, the NXT brick automatically starts running the model when Simulink finishes downloading the model to the NXT brick.

You can see when the NXT brick starts running a model by observing the LCD on the NXT brick. For models that do not use an LCD block, the LCD on the NXT brick displays "I am running ..." followed by the model name. For models that use an LCD block, the model displays whatever output is sent to it.

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 Timer

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

  2. Connect the Timer block to the LCD block, as shown.

  3. Prepare and run the model on the NXT brick.

  4. Observe the elapsed time, in milliseconds, on the LCD display.

Dialog Box

Sample time

Specify how often the block reads timer values.

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?