I have heard that if you change motor direction very fast, and leave it running in one direction longer than the other, it will spin at controlled speed in the desired direction. But the thing that supposedly makes it better than ordinary PWM is that the motor is always under precise control, it never spins uncontrollably. I don't know how this way of control is called so I cannot Google it :\
I am interested to know if there is any existing project / library for Arduino that utilises this way of control? I could easily program it myself, yes, but problem arises when I try to take the frequency up to 21 kHz (beyond the hearing range). This makes the timing very problematic, as I have only 47 microseconds to let it spin in one, then the other direction. Specifically, the problem is the Arduino's timer, which increments every 4 microseconds. This doesn't allow me fine control of the motor as there are only about 12 steps for motor speed in such small time frame.
I would appreciate any help/advice on this matter!