Eye#
Introduction#
The VEX VR Eye Sensor can detect objects and identify their color, brightness, and hue. It also allows you to adjust detection range and lighting settings for more accurate readings.
Below is a list of all available blocks:
eye near object? – Returns whether the Eye Sensor is near an object.
eye detects color? – Returns whether the Eye Sensor detects a specific color.
eye brightness – Return the brightness detected by the Eye Sensor.
when eye – Executes the attached stack of blocks when the Eye Sensor detects or loses an object.
eye near object?#
The eye near object? block returns a Boolean indicating whether or not the Eye Sensor detects an object within range.
True – The sensor has detected an object.
False – The sensor has not detected an object.
<[FrontEye v] está cerca del objeto?>
Parameters |
Description |
|---|---|
eye |
The Eye Sensor to detect objects with. |
Example
cuando empezó
[Stop driving after detecting an object.]
unidad [adelante v]
esperar (0.1) segundos
esperar hasta <[FrontEye v] está cerca del objeto?>
deja de conducir
eye detects color?#
The eye detects color? block returns a Boolean indicating whether the Eye Sensor detects a specified color, based on the detected hue value.
True – The sensor detects the specified color.
False – The sensor does not detect the specified color.
<[FrontEye v] detecta [rojo v]?>
Parameters |
Description |
|---|---|
eye |
The Eye Sensor to detect colors with. |
color |
The color to detect:
|
Example
cuando empezó
[Stop driving after detecting a green object.]
unidad [adelante v]
esperar (0.1) segundos
esperar hasta <[FrontEye v] detecta [verde v]?>
deja de conducir
eye brightness#
The eye brightness block returns the brightness detected by the Eye Sensor from 0% to 100%.
([FrontEye v] brillo en %)
Parameters |
Description |
|---|---|
eye |
The Eye Sensor to detect brightness from. |
Example
cuando empezó
[Display whether a detected object is bright.]
unidad [adelante v]
esperar hasta <[FrontEye v] está cerca del objeto?>
esperar (0.1) segundos
si <([FrontEye v] brillo en %) [math_less_than v] [70]> entonces
imprimir [Object not bright.] ▶
demás
imprimir [Bright object!] ▶
when eye#
The when eye block runs the attached stack of blocks when the selected Optical Sensor detects or loses an object.
cuando [FrontEye v] [detects v] un objeto :: hat events
Parameters |
Description |
|---|---|
eye |
The Eye Sensor to use. |
state |
Which action to trigger the hat block:
|
Example
cuando [FrontEye v] [loses v] un objeto :: hat events
[Find an object when it is lost.]
turno [derecha v]
esperar hasta <[FrontEye v] está cerca del objeto?>
deja de conducir