How to make the mbot turn 180 degrees


#1

I am trying to make a robot where it can go from point a to point b and then turn around and go back, but I ran into a problem where once the robot detects an object in front of it it just continuously turns in a circle.
I am using the start kit and this is my code:


#2

Well the bot does exactly as programmed. You made two mistakes, see my comments in the picture.


#3

ohhh, thx for the notes I will see what I can do to fix that code


#4