Coding with the VEX GO Eye Sensor

The VEX GO Eye Sensor is used to detect if an object is near, and if so, determine the color of that object.

GO_Brain-Battery-Eye.png

The following article will cover:

Note: in this article, the example projects use two different GO Builds:

  • Code Base - Eye Down GO Build
  • Code Base - Eye Forward GO Build

How the Eye Sensor is Used

DetectingRed.png

The VEX GO Eye Sensor is used to detect if an object is near, and if so, determine the color of that object.

GO_Brain-ButtonPush.png

The Eye Sensor must be attached to the Brain before powering the Brain on in order to work properly. If the Eye Sensor is attached or removed after the Brain has already been powered on, the Brain must be power cycled (turned off and then back on) in order for the Eye Sensor to function properly.

The Eye Sensor can detect:

_Detects_color__block.png

A certain color.
The Eye Sensor can detect the colors red, green, and blue using the <Detects color> block.

_Found_object__block.png

If an object is present.
The Eye Sensor can detect if an object is close to it using the <Found object> block. This can be used to detect Disks if the Eye Sensor is facing down or detects objects in front of it, such as obstacles or walls.

The Eye Sensor can report:

_Brightness_of__block.png

Brightness levels.
The Eye Sensor can report the brightness level of an object using the (Brightness of) block. This can be used to distinguish between light and dark objects. This can be useful when line-tracking.

_Hue_of__block.png

A hue color value in degrees.
The Eye Sensor can report a hue color value of an object using the (Hue of) block. This can be useful when determining the colors of different objects.

rainbow-circle-graphic.jpg

The (Hue of) block reports a hue value between 0 - 359 degrees.


Eye Detect Color Example Project

Detect_color_example_project.png

The code below will drive the Code Base - Eye Down GO Build forward until it detects a red Disk. Once a red Disk is detected, the Code Base will stop driving.


Eye Detect Brightness Example Project

Eye_detects_brightness_snipit.png

The code below will drive the Code Base - Eye Down GO Build until it detects a dark line on the GO Field Tile.

GO_Tile_-_TD.png

Once a dark line on the Tile is detected, the Code Base will stop driving.

Eye_Detect_Brightness_project_copy.jpeg

The Monitor Console can be used to see the brightness value changing in real time. This can be used to determine the threshold value of the dark line on the Tile.


Eye Detect Object Example Project

Eye_Detect_Object_snipit.png

The code below will drive the Code Base - Eye Forward GO Build until it detects an object. Once an object is detected, the Code Base will stop driving.


Eye Report Hue Example Project

Eye_Hue_snipit.png

The code below will use the Code Base - Eye Forward GO Build to report the hue color value of different objects.

Eye_Hue_project_markup.jpeg

The Print Console can be used to see the hue value changing in real time. This example reported the hue value of a red Disk.

Hue_chart_red.jpg

The value can then be compared to the hue chart.