The working structure of line follower robot
So there will be infrared proximity sensors placed on either side at the front of the robot. There are four possible sensor outcomes:
Case 1:
In this case, both the sensors don't detect the line. Both the motors rotate forward. As a result, the car moves forward.
Case 2:
In this case, only the left sensor detects the line which means that the car requires to turn in the left direction. The left motor rotates backward and the right motor rotates forward. As a result, the car turns left.
Case 3:
In this case, only the right sensor detects the line which means that the car requires to turn in the right direction. The left motor rotates forward and the right motor rotates backward. As a result, the car turns right.
Case 4:
In this case, both the sensors detect the line. This means that the end has come. Both the motors stop rotating. As a result, the car stops.