Hi Chuck, thanks for replying. I’m going to post the rest of the code. My thought was that the more simple the code was that I posted, the more likely the response. I stripped my code all the way down to just breaking the loop and stopping though, and that was successful. So, that obviously isn’t my problem.
With the code you see below, when I put an object in front of the bot, the lights turn on but it simply keeps moving forward. It actually stops turning at that point and will just keep moving towards the object as long as I keep it in front of it.
I put the if statement in the turn, because in a previous revision of my code, an object in front would break the loop, but it would immediately turn. I want it to come to a complete stop when an object is in front.
The timerVar is just an arbitrary value. I started using that after reading somewhere on here that using wait is bad because it stops everythinig. The advice was to use the milli() ?? function, but I am trying to stay out of the code completely and do this in mBlock, so incrementing a variable was the next best thing I could come up with.