Ojo#

Introducción#

The VEX GO 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. The Eye Sensor can also use a near or far range to detect objects at different distances.

The Eye Sensor can be placed in different positions depending on the build. For example, the Code Base 2.0 - Eye Forward build has the Eye Sensor facing forward. The Code Base 2.0 - Eye Down build, Code Base 2.0 ‑ Eye + Electromagnet, and Super Code Base 2.0 has the Eye Sensor facing down.

Below is a list of all available blocks:

fijar la luz de los ojos#

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.

establecer luz de ojo [encendido v]

Parámetros

Descripción

estado

The state of the Eye Sensor’s light: on or off.

Ejemplo

cuando empezó :: hat events
[Build Used: Code Base 2.0 - Eye Forward]
[Turn the light on and off.]
para siempre
establecer luz de ojo [encendido v]
esperar [2] segundos
establecer luz de ojo [apagado v]
esperar [2] segundos

establecer el rango de los ojos#

The set eye range stack block sets how far an object can be from the Eye Sensor before it can be detected.

Every project begins with the Eye Sensor set to far range by default.

establecer el ojo en el rango [near v]

Parámetros

Descripción

rango

The Eye Sensor’s object detection range. near detects objects up to 18 millimeters away, while far detects objects up to 40 millimeters away.

Ejemplo

cuando empezó :: hat events
[Build Used: Code Base 2.0 - Eye Forward]
[Drive to an object with different ranges.]
establecer el ojo en el rango [far v]
unidad [adelante v]
esperar hasta <¿El ojo encontró un objeto?>
unidad [atrás v] para [100] [mm v] ▶
esperar [1] segundos
[Closer detection range.]
establecer el ojo en el rango [near v]
unidad [adelante v]
esperar hasta <¿El ojo encontró un objeto?>
deja de conducir

ajuste de la potencia de la luz ocular#

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.

Establezca la potencia de la luz ocular al [50]%

Parámetros

Descripción

brillo

The brightness to set the Eye Sensor’s light to, from 0% to 100%. Use whole numbers.

Ejemplo

cuando empezó :: hat events
[Build Used: Code Base 2.0 - Eye Forward]
[Turn on the light at different brightnesses.]
Establezca la potencia de la luz ocular al [25]%
esperar [2] segundos
Establezca la potencia de la luz ocular al [50]%
esperar [2] segundos
Establezca la potencia de la luz ocular al [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.

The detection range can be changed using the set eye range block.

<¿El ojo encontró un objeto?>

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Build Used: Code Base 2.0 - Eye Forward]
[Drive forward until an object is detected.]
unidad [adelante v]
esperar hasta <¿El ojo encontró un objeto?>
deja de conducir

eye detects color#

The eye detects color Boolean block reports whether the Eye Sensor detects a specific color, based on the detected hue value.

  • True — The Eye Sensor detects the selected color.

  • False — The Eye Sensor does not detect the selected color.

The Eye Sensor works best when the object is close enough to detect and the lighting is clear.

To check the exact hue value detected by the Eye Sensor, use the eye hue reporter block.

<¿El ojo detecta [rojo v]?>

Parámetros

Descripción

color

The color for the Eye Sensor to detect:

  • red – Hue value between 340° and 20°.
  • green – Hue value between 75° and 154°.
  • blue – Hue value between 160° and 254°.
  • none – None of the available colors are detected.

Ejemplo

cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Drive forward until a Green Disk is detected.]
unidad [adelante v]
esperar [0.2] segundos
esperar hasta <¿El ojo detecta [verde v]?>
deja de conducir

brillo de los ojos#

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.

(brillo ocular en %)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Monitor the brightness until a Red Disk is detected.]
unidad [adelante v]
repetir hasta <¿El ojo detecta [rojo v]?>
borrar todas las filas
imprimir (brillo ocular en %) ▶
esperar [0.1] segundos
fin
deja de conducir

tono de ojos#

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.

Una rueda de colores circular que muestra un espectro completo de tonalidades etiquetadas con valores de grados alrededor del perímetro, aumentando en incrementos de 30 grados desde 0° en la parte superior hasta 360°.

(tono de ojos en grados)

Parámetros

Descripción

Este bloque no tiene parámetros.

Ejemplo

cuando empezó :: hat events
[Build Used: Code Base 2.0 - Eye Forward]
[Display the hue of a pink GO piece.]
para siempre
borrar todas las filas
si <[10] [math_less_than v] (tono de ojos en grados) [math_less_than v] [40]> entonces
imprimir [Pink!] ▶
demás
imprimir [Not pink.] ▶