Eye#

Introduction#

The VEX 123 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:

set eye light#

The set eye light block turns the Eye Sensor’s light on or off.

establecer luz de ojo [encendido v]

Parameters

Description

state

The state of the sensor’s light:

  • on
  • off

Example

cuando empezó
[Continuously blink the light.]
para siempre
establecer luz de ojo [encendido v]
esperar (2) segundos
establecer luz de ojo [apagado v]
esperar (2) segundos

set eye power#

The set eye power block sets the brightness of the Eye Sensor’s light. If the light is off, this block will turn it on if the new brightness is not 0%.

Establezca la potencia de la luz ocular al (50)%

Parameters

Description

brightness

The new brightness to set the sensor’s light to from 0% to 100%.

Example

cuando empezó
[Set the light to different power levels.]
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 object?#

The eye found 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.

<¿El ojo encontró un objeto?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Stop driving after detecting an object.]
establecer luz de ojo [encendido v]
unidad [adelante v]
esperar (0.1) segundos
esperar hasta <¿El ojo encontró un 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.

<¿El ojo detecta [rojo v]?>

Parameters

Description

color

The color to detect:

  • red – A detected hue value between 340°-20°.
  • green – A detected hue value between 80°-145°.
  • blue – A detected hue value between 160°-250°.

Example

cuando empezó
[Stop driving after detecting a green object.]
establecer luz de ojo [encendido v]
unidad [adelante v]
esperar (0.1) segundos
esperar hasta <¿El ojo detecta [verde v]?>
deja de conducir

eye hue#

The eye hue block returns the hue detected by the Eye Sensor in degrees from 0 to 359.

A circular color wheel displaying a full spectrum of hues labeled with degree values around the perimeter, increasing in 30-degree increments from 0° at the top to 360°.

(tono de ojos en grados)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Display if an object is pink.]
para siempre
borrar todas las filas
si <[290] [math_less_than v] (tono de ojos en grados) [math_less_than v] [350]> entonces
imprimir [Pink!] ▶
esperar (0.1) segundos
demás
imprimir [Not pink!] ▶
esperar (0.1) segundos

eye bright object?#

The eye bright object? block returns a Boolean indicating whether or not a detected object has a brightness value greater than 70%.

  • True – The detected object has a brightness value over 70%.

  • False – The detected object has a brightness value less than or equal to 70%.

<¿ojo objeto brillante?>

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Display whether a detected object is bright.]
Establezca la potencia de la luz ocular al (100)%
unidad [adelante v]
esperar hasta <¿El ojo encontró un objeto?>
esperar (0.1) segundos
si <¿ojo objeto brillante?> entonces
imprimir [Bright object!] ▶
demás
imprimir [Object not bright.] ▶

eye brightness#

The eye brightness block returns the brightness detected by the Eye Sensor from 0% to 100%.

(brillo ocular en %)

Parameters

Description

This block has no parameters.

Example

cuando empezó
[Display whether a detected object is bright.]
Establezca la potencia de la luz ocular al (100)%
unidad [adelante v]
esperar hasta <¿El ojo encontró un objeto?>
esperar (0.1) segundos
si <(brillo ocular en %) [math_less_than v] [70]> entonces
imprimir [Object not bright.] ▶
demás
imprimir [Bright object!] ▶