Hello everyone!Me and my friend are studying at a class that teaches about mBlock.Every time they give us challenges/exercises to do.So Today They gave us a challenge to draw letter T and Z and that was good and easy but after that they told us to make it run forward for infinite time and when it sees obstacle it goes backward 1/2 the distance it ran forward without the seconds.
Since this is probably to make you think, I will not give the code but hints. The problem works if the mBot comment at 400mm or less because the ultrasonic sensor has a maximum. The diagram I made is for a return to the initial location without the seconds and therefore not with a return 1/2 of the distance.
There you go … good luck …
Use the ultrasonic capture and stop when you have obtained the value you want
Did you find the solution ?? Here’s one more clue …