Eye Sensor - Robot Features - VEXcode VR

The VEX VR Robot has a multitude of sensors, including two Eye Sensors.

The following article will cover:

  • Eye Sensors on the VR Robot
  • VEXcode VR Blocks Used with the Eye Sensors
    • Color near object block
    • Color sensing block
  • Common Uses of the Eye Sensor
  • Eye Sensor Example Project

Eye Sensors on the VR Robot

The VR Robot has two Eye Sensors, one that faces forward, and another that faces down. The sensors can detect if there is an object present as well as detect color (red, green, blue, none).

front down eye

The Eye Sensor values can be displayed on the Dashboard in VEXcode VR. To learn more about the Dashboard, view the Dashboard - Playground Features - VEXcode VR article.

Eye sensor dashboard

The Eye Sensor values can be displayed on the Monitor Console in VEXcode VR. To learn more about the Monitor Console, view the Variable and Sensing Values Monitoring - Tutorials - VEXcode VR article.

Eye sensor monitor


VEXcode VR Blocks Used with the Eye Sensors

Color near object block

The Color near object block reports if the Eye Sensor is close enough to an object to detect a color (red, green, blue, none).

Color_near_object_block.png

The Front or Down Eye Sensor can be selected from the drop-down menu on the block.

Color_near_object_drop_down_menu.png

The Color near object block is a boolean block that reports true when the Eye Sensor is close to an object that has detectable colors, and reports false when it is not close enough to an object with detectable colors.

Monitor true zoom

Color sensing block

The Color sensing block reports if the Eye Sensor detects a specific color.

Color sensing block

The Front or Down Eye Sensor can be selected from the drop-down menu on the block.

Color sensing block

The color that the Eye Sensor is looking for can be selected from the drop-down menu on the block.

Color sensing dropdown

The Color sensing block is a Boolean block that reports true when the Eye Sensor detects the selected color, and reports false when it does not detect the selected color.

Monitor detect green


Common Uses of the Eye Sensor

The Eye Sensors on the VR Robot can be used in many ways. One thing to note about the Down Eye Sensor, is that it is tuned to not detect the floor of a Playground as an object. Other items, such as disks, will register as an object.

The Eye Sensors can detect the color of an object near the sensor, such as the colored disks in the Disk Mover Playground or the red border around the Castle Crasher Playground. This is useful if you want the VR Robot to sort differently colored objects, drive up to a specifically colored object, or detect the color of objects as they pass by the sensor.

Eye disk mover

The VR Robot can use the Eye Sensors to initiate a sequence of behaviors when it is in the correct place to do so. For example, the VR Robot can drive forward until it detects that it is near an object, such as a wall, then turn 90 degrees, or drive in reverse to not crash into an object, such as a castle, disk, or wall. Eye wall maze


The VR Robot can use the Eye Sensors to drive toward an object or surface until it is within a specific distance, without touching it. This can be used to make sure that the VR Robot does not fall off of a Playground or crash into walls.

Detect red eye down


Eye Sensor Example Project

In the following example, the VR Robot will drive forward until the Front Eye Sensor detects a green object, then it will stop and wait, before driving in reverse. Notice that in the Dashboard, the Front Eye Sensor values are reporting true that an object was detected, and the color of that object (disk) is green.

Front eye object