Main Content

Infrared Sensor

Detect button status on LEGO remote infrared beacon, measure beacon proximity and heading, and measure object proximity using infrared sensor connected to EV3 brick

Add-On Required: This feature requires the Simulink Support Package for LEGO MINDSTORMS EV3 Hardware add-on.

  • Infrared Sensor block

Libraries:
Simulink Support Package for LEGO MINDSTORMS EV3 Hardware

Description

Use the Infrared Sensor block to measure and detect these parameters using the infrared sensor connected to an EV3 brick.

  • detect the button pressed on the remote infrared beacon

  • measure beacon proximity and heading

  • measure object proximity using infrared sensor

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

Ports

Output

expand all

The block outputs these identification number of the button pressed on the LEGO® remote infrared sensor.

Button ID Table

Dependencies

  • To enable this port, set Mode to Remote.

Data Types: int8

The block outputs the angle from the direction the infrared sensor is pointing to.

Dependencies

  • To enable this port, set Mode to Beacon Proximity.

Data Types: int8

The block outputs the proximity of the object in front of the infrared sensor in percentage.

Dependencies

  • To enable this port, set Mode to Beacon Proximity or Proximity.

Data Types: uint8

Parameters

expand all

Select the EV3 brick input port to which the infrared sensor is connected. Avoid assigning multiple devices to the same input port.

Select the infrared beacon channel number on the EV3 brick.

Dependencies

  • To enable this parameter, set Mode to Remote or Beacon Proximity.

Specify the frequency of how often the block reads sensor values connected to the EV3 brick. Shorter sample times, such as 0.01, may produce unreliable measurements.

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

Version History

Introduced in R2013a