We start a course for following a line with crosses and gaps. This is a challenge that one of the users at FLLCasts.com was trying to accomplish and asked us for advice. We present the whole challenge to you step-by-step. But first, let's also see the whole run of the line following algorithm. With this course, we also do an introduction of using State Machine as a programming pattern.
The gaps are 0.1 meters in length. The robot doesn't know where the gaps are, where the turns are. It should come from the start to the end. We show the complete line following run so that you have an idea of how the whole program behaves and what the result is at the end.
The only way to properly learn how to follow lines is to actually do the programming at each step. Try to program the robot, and then share the results with us of how successful it was.
While programming we implement a pattern. This pattern is called "State Machine". A state machine has a number of states and transitions between these states. We sometimes call these transitions "behaviours".