New 28BYJ-48 library

Pasted from above:

The library is setup to run other code in loop while spinning the motor non-blocking without using interrupts. First initialize the move you want to make 1x. This could be done in setup or an if statement in loop for example:

void degrpm_nowait (boolean bcw, long deg100, int rpm100)

Then call this function often:

int calloften_micro (boolean bcw)

At faster speeds you have to call it more often or it will get behind and run slower. You can look at d in loop to see how much time you have in micros. There are lines to uncomment if you want it to be more smooth consistent and partly blocking, some of the time. The calloften functions use little integer math so they are fast.

There is another pair of functions for going slower and cooler using 12v:
void degrpmslowCool4_nowait (boolean bcw, long deg100, int rph100)
int calloften()

With these functions you have much more free time to process in loop, d milliseconds. If you miss a step it's no big deal, the motor will catch up to keep the speed mostly constant. It will move the correct distance no matter what you do wrong with timing.

All you have to do is choose the RPM and *100.