IR Sensor and Remote Infrared Beacon
To connect from the MATLAB® software to the EV3 Infrared Sensor (item number 45509), use the
irSensor
function to create a irSensor
object.
To get the relative distance of an object in front of the sensor, use the
readProximity
function with theirSensor
object. In this mode, the sensor emits infrared light, and measures the amount of light nearby objects reflect back to the sensor. It represents this measurement as a range, from 0 to 100 (dark to light). The maximum range of the sensor is approximately 70 cm (27 inches).To get the relative proximity and heading of an EV3 Remote Infrared Beacon (item number 45508), use the
readBeaconProximity
function with theirSensor
object. Specify the channel number of the Remote Infrared Beacon. The sensor detects infrared light from the beacon, and uses that data to estimate the heading and distance to the beacon. The sensor returns the relative heading as a value from -25 to 25 (left to right). The sensor returns the relative distance as a value from 0 to 100 (near to far).To get the a number that corresponds to pressed buttons on the Remote Infrared Beacon, use
readBeaconButton
function with theirSensor
object. Specify the channel number of the Remote Infrared Beacon. For information about the values produced by various button combinations, refer to Using the Infrared Sensor Remote Mode.
Note
The Remote Infrared Beacon has a red slider switch with four
positions. This switch specifies the channel number, 1 through 4,
the beacon uses to communicate with the infrared sensor. When you
use the readBeaconProximity
and readBeaconButton
function,
specify the channel number on the beacon. The maximum range from the
sensor to the beacon is approximately 200 cm (79 inches).