EV3 Color Sensor¶
Non-Visible componentCategory | Requires | Version |
---|---|---|
LEGO® MINDSTORMS® > EV3 | API 21, Android 5.0 Lollipop | 2 |
Overview¶
A component that provides a high-level interface to a color sensor on a LEGO MINDSTORMS EV3 robot.
Events¶
Above Range¶
Light level has gone above the range.
Below Range¶
Light level has gone below the range.
Color Changed¶
Called when the detected color has changed. The ColorChanged event will occur if the Mode property is set to "color" and the ColorChangedEventEnabled property is set to True.
Params | |
---|---|
color Code | Number |
color Name | Text |
Within Range¶
Light level has gone within the range.
Methods¶
Get Color Code¶
Returns: Number
It returns the color code from 0 to 7 corresponding to no color, black, blue, green, yellow, red, white and brown.
Get Color Name¶
Returns: Text
Return the color name in one of "No Color", "Black", "Blue", "Green", "Yellow", "Red", "White", "Brown".
Get Light Level¶
Returns: Number
It returns the light level in percentage, or -1 when the light level cannot be read.
Set Ambient Mode¶
Deprecated
Make the sensor read the light level without reflected light.
Set Color Mode¶
Deprecated
Enter the color detection mode.
Set Reflected Mode¶
Deprecated
Make the sensor read the light level with reflected light.
Properties¶
Above Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the AboveRange event should fire when the light level goes above the TopOfRange.
Below Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the BelowRange event should fire when the light level goes below the BottomOfRange.
Bluetooth Client¶
Component Read Write - Designer Blocks
The BluetoothClient component that should be used for communication.
Bottom Of Range¶
Number Default: 30 Read Write - Designer Blocks
The bottom of the range used for the BelowRange, WithinRange, and AboveRange events.
Color Changed Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the ColorChanged event should fire when the Mode property is set to "color" and the detected color changes.
Mode¶
Text Default: reflected Read Write - Designer Blocks
Specifies the mode of the sensor.
Sensor Port¶
Text Default: 1 Write - Designer
The sensor port that the sensor is connected to.
Top Of Range¶
Number Default: 60 Read Write - Designer Blocks
The top of the range used for the BelowRange, WithinRange, and AboveRange events.
Within Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the WithinRange event should fire when the light level goes between the BottomOfRange and the TopOfRange.