Stepper motor CNC shield accelstepper.h

And in the code which you have provided the index will be set to 0 in every iteration of the loop right?