Module 2 · Line Tracking
Lesson 2 · Drive to the Edge and Stop — Knowledge ChecksAnswer key
Which loop fits the task 'drive until the robot detects a line'?
You don't know the number of steps in advance, so you loop while the sensor says 'no line' — that's a while loop.
A student's robot drives forward and never stops, even over the line. What did they most likely forget?
Without updating left inside the loop, the condition stays true forever — a classic infinite loop.
The threshold is 0.5 and the sensor reads 0.3. Is `left < threshold` True or False?
0.3 < 0.5 is True, so the loop keeps running — the robot is still on white and should keep driving.