3

I am trying to create a robot that follows a line. I want the robot to turn on its vertical axis ("move-tank") until it finds the line again and then keep going straight. My problem is that the "repeat turning until color sensor value is less than 20" loop does not stop although the sensor value meets the criteria (i.e. less than 20).

This is my code:

enter image description here

Any ideas what am I doing wrong?

The logic inside the loop 02 is that it turns tank-left (-10,10) for 0.5, then it turns tank-right (-1 x -10, -1 x 10) for 0.5 + 0.3 seconds, etc until it finds the line (sensor value < 20).

2

The loop does stop but you can not see it: You should add a brake block after the loop that runs until colour sensor<20 otherwise there is no visible indication that the loop has stopped. Hope this helped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.