The light sensor enables the robot to “see” light intensity and colors. We prefer to call it color sensor. It can differentiate between most basic colors and thus help the robot act accordingly when it detects or does not detect your color of choice.
Attaching a Color Sensor
Please refer to pp. 68-72 of the EV 3 Manual (Building Instructions) for a color sensor facing downwards, and pp. 73-75 for a setup with a forward-facing sensor.
Programming: Step-by-step Instructions
Exercise: Moving along a Black Line
This example is great practice that shows how the color sensor can be used to guide the robot’s movements, i.e., along a black line.
Please find a printable version of the following instructions HERE.
1) First, put a <Switch Block> inside a <Loop Block>.
Add two <Move Steering Blocks>.
Set the <Switch Block> for the <Color Sensor> to <Compare> <Color>.
See figure below:
2) Next, select the color of the line you wish to follow. Make sure only the color you want is selected.
3) Then, fine-tune the motors’ steering, rotations, and power until the robot moves along the line as desired. Note this is contextual and may take some adjustments for the robot to follow the line.
Please find a printable version of the “Moving along a Black Line” task HERE.
© 2019 Dr. Krista Francis & Stefan Rothschuh