Has anyone written a library for these shields?
If so where would I find it on github?
There is an off-the-shelf Arduino program called GRBL that works with them.
If that is not what you want then it is straightforward to control stepper motors with drivers attached to the shield. You just need to know which Arduino pin connects to each pin of each driver. The shield datasheet should tell you that.
...R
Stepper Motor Basics
Simple Stepper Code
also look up the AccelStepper library
Robin2:
There is an off-the-shelf Arduino program called GRBL that works with them.If that is not what you want then it is straightforward to control stepper motors with drivers attached to the shield. You just need to know which Arduino pin connects to each pin of each driver. The shield datasheet should tell you that.
...R
Stepper Motor Basics
Simple Stepper Codealso look up the AccelStepper library
Examining the source for Accel Stepper it looks as though the 4 driver chips on the shield would be 2 wire interface.
Basically the input to the drivers is HIGH for a single step on one pin and an input on the other pin for a direction.
But this is where the A4988 datasheet leaves me confused. How does the DIR pin work?
HIGH: clockwise, LOW: anticlockwise or vice versa?
Or
HIGH: reverse direction form current, LOW same direction as current or vice versa?
In which case the library would have to keep track of which direction the stepper is rotating if you want to use negative step values for anticlockwise and positive values of clockwise.
But I can see how the Accel speed settings work through the various ::run...(...) functions, i.e. one step every call to 'run' for high speed and one step every X calls to 'run' for slower speeds.
Think I might design my own library though and try and do away with the floating point stuff that Accel stepper library has.
When the DIR pin is LOW the motor rotates in one direction. When it is high it goes in the other direction. If it is going the wrong way you can either change your code (probably easiest) or (I think) swap the wiring connections to one of the motor coils.
Be VERY CAREFUL never to disconnect the wires between the motor and the stepper driver while the driver is powered up. The driver will be instantly destroyed.
There are some potential misconceptions in Reply #2
the input to the drivers is HIGH for a single step on one pin
A step is caused by a LOW to HIGH transition of the STEP pin. It is usual just to cause a short HIGH pulse of about 10 µsecs.
every call to 'run' for high speed and one step every X calls to 'run' for slower speeds.
You should call stepper.run() considerably more frequently than the fastest step rate that you require If you don't there is a probability of missed steps or the wrong timing.
...R