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:

  • How the Eye Sensor is Used
    • The Eye Sensor can detect
    • The Eye Sensor can report
  • Eye Detect Color Example Project
  • Eye Detect Brightness Example Project
  • Eye Detect Object Example Project
  • Eye Report Hue Example Project

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

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

DetectingRed.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.

GO_Brain-ButtonPush.png

The Eye Sensor can detect:

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

_Detects_color__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.

_Found_object__block.png

The Eye Sensor can report:

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.

_Brightness_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.

_Hue_of__block.png

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

rainbow-circle-graphic.jpg


Eye Detect Color Example Project

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.

Detect_color_example_project.png


Eye Detect Brightness Example Project

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

Eye_detects_brightness_snipit.png

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

GO_Tile_-_TD.png

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_Brightness_project_copy.jpeg


Eye Detect Object Example Project

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_Detect_Object_snipit.png


Eye Report Hue Example Project

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

Eye_Hue_snipit.png

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.

Eye_Hue_project_markup.jpeg

The value can then be compared to the hue chart.

Hue_chart_red.jpg