Sorry my english is not good,I am a newbie.
I have 4 closed-loop stepper motor(1000Pulse/rev),I want him to be a mobile platform.
So I want to control his speed and distanc,I try to use the digital pin to output the pulse wave.
Suppose I want to generate a 10khz pulse,So then I have to generate a pulse in 1/10000 second =100microseconds
So I used "wait" and set it to 100 microseconds,But not as fast as I want!!
I tried to generate the same frequency with pwm and the speed of the motor became very fast.
But I don't want to use pwm to generate,Because I cannot control how many pulses are output
what's wrong with my program? What can i do?Or how can I achieve this project(control his speed and distanc)?
I shot a sample video--->https://youtu.be/mgX5Ienj4vI