Mbot line follower

Hi, i need help with my code. The mbot has to start and follow the line when i press A on my remote, while it's running it's suppose to show green lights. When mbot comes to the end of the line he is suppose to blink red lights. Red lights are suppose to blink 1 sec appart and blinking has to last in time of the mbot ride. So if ride was 12s, red blinking should be 12s and stop. With this code, everything works excpet red blinking goes on forever and never stops. Thanks!

blinking red lights

Sorry, i will be more specific. i need help with the last part of the code. when the robot stops he needs to blink red lights in time of the ride. so if the robots ride was 10s, blinking should last 10s. How to i make it blink in time of the ride? With my code the blinkin goes on forever. Thanks

Hi

I’ve never used this way of programming but to me it looks like this is the problem :

If “linefollower Port2 = 3” then it works fine blinks till “timer > tranjanje” . It pops out of that if block but since it is still in the “forever” loop it checks all if statements again but “lineFollower Port2” is still equal to 3 so it does execute that if block again and again that way your stuck and it seems like it is stuck in the “repeat” block.

Try to remove the “forever block” or put the “wait until <ir remote A pressed>” in the “forever” loop so that if it succesfully blinked you can press A again to repeat all.

I hope that helps !

And also, your blink time

And also, your blink time might not be very precise because you only check timer > tranjanje every 2 seconds so:

timer tranjanje

0 < 6

2 < 6

4 < 6

6 = 6

8 > 6

 

That way since 6 is not larger than 6 it would blink for two more seconds although it shouldn’t.