The rotation sensor which is build into the ‘servo’ motors and typical used by the ‘move’ blocks, can also be used separately to track the overall distance driven. This maybe helpful for example, if you know what the width and length of a course in wheel rotations, and use these as bounds while doing a number of actions depending on what you encounter.
Imagine you have a maze like this, the robot needs to start in the black square labeled “Start” and find all subsequent squares and take a different action in the red versus yellow square. Count the number of red and yellow squares detected and finish by being fully in the black square labeled “Finish”.
One of the strategies – certainly not the only one would be to know how many rotations a robot can drive forward out of the “Start” square to cross the full length of the board, as well as how many rotations the board is wide.
Using that data you could construct for example one drive loop to look like this, where the loop is controlled by calculating the overall distance driven independent of what is going on inside the loop and the various switch path driven by the color sensor.
Below are the various settings for the Loop and the Switch.