Accelstepper function

I suggest that you make the index variable global instead of static local. You will have to set index to 0 and the flag to true to run the sequence again.