Follow the edge of the line.
How do you tell the robot to turn?
Feed a steering command to the "Move" block.
An input plug for the steering value is available at the data hub of a "Move" block. Feed your steering command to the input plug.
How do you know which direction should the robot turn, to follow the edge of the line?
Pick a target intensity value between Black and White, for the light sensor reading. Then steer to the black if the light sensor see too much white, and steer to the white if the light sensor see too much black.
How do you know which side is black and which side is white?
Depending on where the robot or the light sensor is located on the line. On the left side of a black line, left side is white and right side is white. On the right side of a black line, right side is white and left side is black.
If your program assume the light sensor is located on the right side of a black line, but it is actually on the left side, what happen?
The robot would steer away from the line because your program assumption becomes wrong if this happen. Try to control the robot so it will start from the "right" side of the line and never leaves that side. Note that the "right" side can be either left or right depending on your assumption.)
Is the line following program complicated?
It does not have to be. Shown below is an example that has only three blocks.
| The robot keeps doing this to adjusting itself left and right. Note that (Light_Sensor_Reading -50) is the steering command feeding into the "Move" block. |