Coding the VEX 123 Eye Sensor using the Coder

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

Side by side of the 123 Robot and the Coder. The Coder contains two Coder cards that read 'When start 123, Drive until object'.


The Eye Sensor on the 123 Robot

123 Robot shown from the front where the Eye Sensor is located. An arrow points to the Eye Sensor, which is located about halfway down the side of the robot and facing forwards.

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

Screenshot of the VEX Classroom App with a 123 Robot's menu opened and the 'Show Device Info' button selected to open the sensing data. The Eye Sensor data is highlighted and lists four sensing values: Brightness, Color, Hue, and Proximity.

Use the VEX Classroom App to learn more about what information is reported by the Eye Sensor.

You will see data including color, brightness, hue, and proximity. Learn more about the data reported by the Eye Sensor in the 123 Robot with the VEX Classroom App in this article.


Coder Cards Used with the Eye Sensor

Detecting object presence Coder cards

Three Coder cards that detect object presence. The cards read If object, If no object, and Drive until object.

The ‘If object’, ‘If no object’, and ‘Drive until object’ Coder cards report if the Eye Sensor is close to an object or not.

Detecting color Coder cards

Three Coder cards that detect color. The cards read If red, If green, and If blue.

The ‘If red,’ ‘If green,’ and ‘If blue’ Coder cards report if the Eye Sensor detects the color specified.

Detecting brightness Coder cards

Two Coder cards that detect brightness. The cards read If bright and If dark.

The ‘If bright’ and ‘If dark’ Coder cards report if an object is bright or dark. This can be used to distinguish between light and dark objects and environments.

Using the Eye Sensor in a Coder Project

Side by side of a 123 Robot on a Field and a Coder project. The Robot is stopped in front of a drawing of a red fox. The Coder project contains 7 cards and reads When start 123, drive until object, if red, play honk, else, play doorbell, end if. Arrows indicate the flow of logic across the If statements.

The image here shows an example of a project using the "If red", "Else", and "End if" Coder cards together to detect an object and determine what behavior should be performed based on the color of that object. This example is also explained in detail in the Background Information of the Little Red Robot STEM Lab Unit.


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. In this animation, as an 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 animation, as an 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 animation, as an 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.

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

Last Updated: