Documentation Center

  • Trial Software
  • Product Updates

Contents

LEGO MINDSTORMS NXT Compass Sensor

Read magnetic heading of compass sensor

Library

Simulink Support Package for LEGO MINDSTORMS NXT Hardware

Description

Read the magnetic heading of the compass sensor. The block outputs the heading as a int8 value, from 0 to 359, where:

  • 0 is North

  • 90 is East

  • 180 is South

  • 270 is West

The sensor reads the heading 100 times per second, and is accurate to within 1 degree.

This block supports the following sensors:

  • HiTechnic NXT Compass Sensor (NMC1034)

  • LEGO® MINDSTORMS® NXT Compass Sensor, Item: #10285

To configure the block, select the NXT brick input port parameter to which this sensor is connected.

Position the sensor away from sources of magnetic interference, such as motors and speakers. This block does not provide a calibration mode to reduce the effects of magnetic interference from nearby objects.

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.

Dialog Box

NXT brick input port

Select the NXT sensor port to which the sensor is connected. Avoid assigning multiple devices to the same port. The options are 1, 2, 3, or 4.

Sample time

Specify how often the block reads sensor 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?