Coding the VEX 123 Eye Sensor with VEXcode 123

The 123 Robot contains many sensors, including an Eye Sensor. The Eye Sensor on the 123 Robot can be coded using VEXcode 123.

Screenshot of example projects created with VEXcode in the VEX Robotics overview, showcasing various programming elements and robot designs to illustrate project capabilities.


The Eye Sensor on the 123 Robot

Screenshot of example projects using VEXcode 123, showcasing various robotics designs and programming interfaces in VEX Robotics, illustrating features and capabilities of VEXcode VR for educational purposes.

The 123 Robot has an Eye Sensor on the front that can detect if there is an object present, as well as detect color (red, green, or blue).


VEXcode 123 Blocks Used with the Eye Sensor

Detecting object presence blocks

Screenshot of example projects created using VEXcode VR, showcasing various robotics designs and programming interfaces, illustrating the capabilities of VEX Robotics in educational settings.

The [Drive until] and <Found object> blocks report if the Eye Sensor is close to an object or not.

<Detects color> block

Screenshot of example projects using VEXcode 123, showcasing various robotics applications and programming interfaces in VEX Robotics.

The <Detects color> block reports if the Eye Sensor detects the specified color.

(Brightness of) block

Screenshot of VEXcode VR interface showcasing example projects for VEX Robotics, highlighting various programming elements and features used in Category 123 projects.

The (Brightness of) block reports the brightness level as a percentage. This can be used to distinguish between light and dark objects and environments.

(Hue of) block

Screenshot of example projects created using VEXcode 123, showcasing various VEX Robotics designs and programming interfaces, illustrating the capabilities of VEXcode VR in educational robotics.

The (Hue of) block reports a hue color value of an object. This can be useful when determining the colors of different objects.

Screenshot of example projects created using VEXcode 123, showcasing various robotics designs and programming interfaces relevant to VEX Robotics and VEXcode VR.

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


Common Uses of the Eye Sensor

The Eye Sensor on the 123 Robot can be used in many ways. The 123 Robot can use the Eye Sensor to initiate a sequence of behaviors when it is in the correct place to do so. For example, the 123 Robot can drive forward until it detects that it is near an object, such as a wall or another 123 Robot, then turn around to not crash into it.

The 123 Robot can make decisions depending on if the Eye Sensor detects a blue object. This is useful if you want the 123 Robot to drive up to a specifically colored object, detect the color of objects as they pass by the sensor, or perform a certain behavior once a color is detected. In this example, if the Eye Sensor detects a blue object, the 123 Robot will turn right. If the Eye Sensor does not detect a blue object, the 123 Robot will turn left.

The 123 Robot can make decisions depending on if the Eye Sensor detects a bright or dark object. In this example, if the Eye Sensor detects a bright object, the 123 Robot will turn right. If the Eye Sensor does not detect a bright object, the 123 Robot will turn left.

Screenshot of example projects created using VEXcode 123, showcasing various robotics designs and programming interfaces for VEX Robotics and VEXcode VR.

The 123 Robot can also report the hue color value of different objects. The Monitor Console can be used to see the hue value changing in real time, when the (Hue of) block is selected and dragged to the Monitor Console icon in the Workspace.

For more information on variable and sensing values monitoring in VEXcode 123, view this article

Screenshot of example projects using VEXcode 123, showcasing various robotics designs and programming interfaces in VEX Robotics and VEXcode VR.

The value can then be compared to the hue chart.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: