Make a program to follow a line using the Color sensor and reflected light. Let's test reflected light to see if it's white or black (on the line), and drive our robot accordingly.
In the ``||logic:Logic||`` Toolbox drawer under the **Conditionals** section, drag out an ``||logic:If then else||`` block onto the Workspace, and drop it into the ``||loops:forever||`` loop.
Open the ``||logic:Logic||`` Toolbox drawer again. From the **Comparison** section, drag out ``||logic:0 <0||``comparisonblockanddropitintothe``||logic:ifthenelse||``block,replacing``true``.
Open the ``||sensors:Sensors||`` Toolbox drawer. From the **Color Sensor** section, drag out a ``||sensors:color sensor light||`` value block and drop it into the second slot of the ``||logic:0 <0||``comparisonblock,replacingthe`0`.
If the value of the reflected light is greater than 40% (white or very light), our robot is outside the line, so steer to the left. In the ``||logic:0 <0||``comparisonblockchangethecomparedvalueto`40`replacing`0`.
Open the ``||motors:Motors||`` Toolbox drawer. Drag out **2** ``||motors:tank large motors||`` blocks and drop one of them into the ``||logic:if||`` part, and the other into the ``||logic:else||`` part of the ``||logic:if then else||`` block.
In the first ``||motors:tank large motors||`` block in the ``||logic:if||`` clause, change the speed values of the motors from ``50%``, ``50%`` to ``5%``, ``15%``. This slows down the robot, and steers it to the left (because the **C** motor is driving faster than the **B** motor).
In the second ``||motors:tank large motors||`` block in the ``||logic:else||`` clause, change the speed values of the motors from ``50%``, ``50%`` to ``15%``, ``5%``. This slows down the robot, and steers it to the right (because the **B** motor is driving faster than the **C** motor).
Now, plug your EV3 Brick into the computer with the USB cable, and click the **Download** button at the bottom of your screen. Follow the directions to save your program to the brick.
Attach a Color Sensor to Port 3 of your brick, and attach your brick to a driving base with large motors attached to Ports B and C. See the instructions for building a _Driving Base with Color Sensor Down_. Test your program by positioning your robot to the right of a dark, thick line and then let it drive!