眼睛#
介绍#
The Eye Sensor can detect objects and colors. It can also report how much light reflects back to the sensor and the hue value of the detected color. The Eye Sensor has a light that can be turned on or off to help it see objects and colors more clearly.
以下是所有可用模块的列表:
set eye light – Turns the Eye Sensor’s light on or off.
set eye light power – Sets the Eye Sensor’s light power level.
eye found an object – Reports whether or not the Eye Sensor detects an object within range.
eye detects color – Reports whether the Eye Sensor detects a specified color.
eye hue – Reports the hue detected by the Eye Sensor.
eye bright object – Reports whether the detected object reflects a lot of light.
eye brightness – Reports the brightness detected by the Eye Sensor.
设置眼灯#
The set eye light stack block turns the Eye Sensor’s light on or off. The light can help the Eye Sensor detect objects and colors more clearly.
设定辨色仪灯 [on v]
参数 |
描述 |
|---|---|
状态 |
The state of the Eye Sensor’s light: on or off. |
例子
当开始
[Continuously blink the light.]
永久循环
设定辨色仪灯 [on v]
等待 (2) 秒
设定辨色仪灯 [灭 v]
等待 (2) 秒
设置眼部照明功率#
The set eye light power stack block sets how bright the Eye Sensor’s light is. The light can help the Eye Sensor detect objects and colors more clearly.
A higher percentage makes the light brighter. A lower percentage makes the light dimmer.
If the Eye Sensor’s light is off, setting the light power above 0% will turn the light on.
If the Eye Sensor’s light is on, setting the light power at 0% will turn the light off.
设定辨色仪灯功率为 (50)%
参数 |
描述 |
|---|---|
亮度 |
The brightness to set the Eye Sensor’s light to, from 0% to 100%. Use whole numbers. |
例子
当开始
[Set the light to different power levels.]
设定辨色仪灯功率为 (25)%
等待 (2) 秒
设定辨色仪灯功率为 (50)%
等待 (2) 秒
设定辨色仪灯功率为 (100)%
eye found an object#
The eye found an object Boolean block reports whether or not the Eye Sensor detects an object within range.
True — The Eye Sensor detects an object.
False — The Eye Sensor does not detect an object.
<辨色仪发现一个对象?>
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Stop driving after detecting an object.]
设定辨色仪灯 [on v]
驱动 [向前 v]
等待 (0.1) 秒
等到 <辨色仪发现一个对象?>
驱动停止
eye detects color#
The eye detects color Boolean block reports whether the Eye Sensor detects a specified color, based on the detected hue value.
True – The Eye sensor detects the specified color.
False – The Eye sensor does not detect the specified color.
To check the exact hue value detected by the Eye Sensor, use the eye hue reporter block.
<辨色仪测得 [红色 v]?>
参数 |
描述 |
|---|---|
颜色 |
The color for the Eye Sensor to detect:
|
例子
当开始
[Stop driving after detecting a green object.]
设定辨色仪灯 [on v]
驱动 [向前 v]
等待 (0.1) 秒
等到 <辨色仪测得 [绿色 v]?>
驱动停止
眼睛颜色#
The eye hue reporter block reports the hue detected by the Eye Sensor as a number from 0 to 359 degrees.
Hue is a way to describe color using numbers around a color wheel.

(辨色仪色度值)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display if an object is pink.]
永久循环
清除所有行
如果 <[290] [math_less_than v] (辨色仪色度值) [math_less_than v] [350]> 那么
打印 [Pink!] ▶
等待 (0.1) 秒
否则
打印 [Not pink!] ▶
等待 (0.1) 秒
eye bright object#
The eye bright object Boolean block reports whether the object detected by the Eye Sensor is bright.
An object is considered bright when it reflects more than 70% brightness back to the Eye Sensor.
True — The detected object reflects more than 70% brightness.
False — The detected object reflects 70% brightness or less.
This can be used before checking for a color to make sure the object is reflecting enough light for the Eye Sensor to detect the color reliably.
<看到明亮对象?>
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display whether a detected object is bright.]
set eye light power to (100) %
驱动 [向前 v]
等到 <辨色仪发现一个对象?>
等待 (0.1) 秒
如果 <看到明亮对象?> 那么
打印 [Bright object!] ▶
否则
打印 [Object not bright.] ▶
眼睛亮度#
The eye brightness reporter block reports how much light is reflected back to the Eye Sensor, as a percentage from 0% to 100%.
A higher percentage means more light is reflected back to the Eye Sensor. A lower percentage means less light is reflected back.
(辨色仪亮度百分比)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display whether a detected object is bright.]
设定辨色仪灯功率为 (100)%
驱动 [向前 v]
等到 <辨色仪发现一个对象?>
等待 (0.1) 秒
如果 <(辨色仪亮度百分比) [math_less_than v] [70]> 那么
打印 [Object not bright.] ▶
否则
打印 [Bright object!] ▶