gifted:
this is the code i tried it with:
That code does not attempt to move the motor one step at a time as suggested in Reply #1 yet you said in Reply #3 that you had tried doing it one step at a time.
It is the one step at a time code that I want to see.
This is probably not doing what you think
distance = duration * 0.034 / 2;
because you are mixing up integer and floating point maths
- 0.034 is much the same as /29 which would work
...R