Infrared Sensor

Detect the buttons pressed on a LEGO Remote Infrared beacon, measure the beacon proximity and heading, or measure the object proximity.

Library

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware

Description

Detect the buttons pressed on the Infrared remote, measure the beacon proximity and heading, or measure the object proximity.

The block output emits values as int8.

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

Parameters

EV3 brick input port Number

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

Mode

Select the required mode of operation for the sensor. The supported modes are:

  • Remote - Set this mode when you want the block to output the ID of the button pressed.

    • 0 = No button, or Beacon Mode is off

    • 1 = Button 1

    • 2 = Button 2

    • 3 = Button 3

    • 4 = Button 4

    • 5 = Buttons 1 & 3

    • 6 = Buttons 1 & 4

    • 7 = Buttons 2 & 3

    • 8 = Buttons 2 & 4

    • 9 = Beacon Mode is on

    • 10 = Buttons 1 & 2

    • 11 = Buttons 3 & 4

  • Beacon Proximity - Set this mode when you want the block to output the proximity of the beacon in percentage and the heading with the values in the range –25 to 25. Put the remote to Beacon mode for this operation.

  • Proximity - Set this mode when you want the block to output the proximity of the object placed in front the IR sensor in percentage.

Channel

Update this value to match the channel setting on the EV3 Infrared Beacon. This parameter appears only when you select Remote or Beacon Proximity values in Mode parameter.

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