This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Color Sensors

To connect from the MATLAB software to the EV3 Color Sensor (item number 45506), use the colorSensor function to create a colorSensor object.

  • To get the color of an object in front of the sensor, use the readColor function with the colorSensor object. The sensor evaluates the color of the object in from of the sensor and returns one of the following values: black, blue, brown, green, red, white, yellow, or no color. For example, you can use this capability to sort colored objects.

  • To measure reflected light intensity, use the readLightIntensity function with the colorSensor object, and set the mode to reflected. In this mode, the sensor emits red 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). For example, you can use this capability to detect a dark line on a light surface.

  • To measure ambient light intensity, use the readLightIntensity function with the colorSensor object, and set the mode to ambient. In this mode, the sensor measures the amount of light it receives from the surrounding environment. It represents this measurement as a range, from 0 to 100 (dark to light). For example, you can use this capability to measure sunlight, or to detect when someone turns a light off.

See Also

| | |