I've been using some sample code I came across and it specified delay(1), which is 1 millisecond. That does the expected number of steps (I think, at least it moves some rotation) but always goes in the same direction.
I tried your suggestion of delay(100) and that does make it go in the desired location (per setting the DIR pin LOW or HIGH), but it only goes about one step. In fact, anything other than the delay(1), as specified in the sample code I'm using, results in the rotation reversing as selected, but only moves about one step, when in fact I'm trying to make it do 100 steps.
Is it possible I should be using delayMicroseconds() to give finer control?
Sorry. 100 was a mistakr. Test a delay of 10 ms.
I've benn running plenty of steppers that needed like 10 ms delay between the steps.
Using a library haaving a eleration is needed for high speed.
What documentation specifies 1 ms?
I think I found the problem, and it's not the delay value. A delay of 1ms appears to be just fine. The problem was in connecting the two "coils" from the motor to the pins on the motor driver.
Every document I've come across has indicated like this:
Red -> 1A
Blue -> 1B
Green -> 2A
Black -> 2B.
Where Red/Blue is one coil, Green/Black is the other coil.
And basically saying that the pins labeled '1'f or one coil, labeled '2' for the other coil.
And that's how I wired it and got the weird results.
I just tried a different wiring, namely:
Red -> 1A
Blue -> 2A
Green -> 1B
Black -> 2B.
In other words one coil goes to the A pins, the other coil goes to the B pins.
And now it's working just fine, reversing direction as desired and controlled via the DIR pin.