I am trying to implement the below pseudo-code for an arduino tank connected to a Sharp distance sensor which attached to the front of the tank:
“If (distance<30), then rotate counterclockwise until distance>30”
What loop should I use?
I had problems getting my loop to stop(the tank did not stop rotating even when the distance was (I think less than 30)):
(the below code is in the void loop() function)
Could delay be used to allow the tank to rotate for a specific amount of time?