The VEX GO Eye Sensor is used to detect if an object is near, and if so, determine the color of that object.
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.
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:
A certain color.
The Eye Sensor can detect the colors red, green, and blue using the <Detects color> block.
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 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.
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.
The (Hue of) block reports a hue value between 0 - 359 degrees.
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.
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.
Once a dark line on the Tile is detected, the Code Base will stop driving.
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.
For more information about monitoring variable and sensing values in VEXcode GO, view this article.
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 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.
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.
The value can then be compared to the hue chart.