Stepper motor spinning forever

Have a look at the examples in Simple Stepper Code

Note that you do not have to spread the time equally between the HIGH and LOW parts of the pulse. The driver just needs a very short HIGH pulse. By putting all of the time in the LOW part it means you only need to change one number when you want to chanage the speed.

...R
Stepper Motor Basics