Making vehicle stop in front of wall using stepper motor and ultrasonic (HELP)

In your stepper code, create a function that steps the motor 1 step. Step the motor 1 step, check the distance. If the distance is below the threshold (close to the wall), stop the stepping. If not, step the motor 1 time, check the distance. Keep going until the robot is as close as you want (threshold).

I tried that but then it doesn't run smooth at all, thankyou tho!

What Arduino are you using?
What driver board are you using for the steppers?
What steppers are you using?
What battery are you using to power your project?

Hey Tom,

I modified the post using the ''code'' brackets, looks alot better indeed.
The arduino i'm using is an Uno, the drivers are two StepStick A4988, steppers are some cheap very basic ones from China and the Battery is a Lithium Ion battery (LIPO ACCU TURNIGY 2200mAh 3S 20C Lipo Pack)

The vehicle is at school at the moment, i'm at home working on the code. I can post an additional picture tomorrow.

Thanks in advance,

  • Gifted