Problem of using stepper motor 17HS4401

Scat:
@Ouatsup

Hello, thanks for your help. I've tried your code and here's is the problem which I encountered:

  1. I'm using your default speed and max speed which is 5000 and 500, when I'm changing the direction from low to high, I need to recalibrate the current by turning the potentiometer on the A4899 driver, is it common for a stepper motors to have different current different direction?

No, they are completely symmetrical.

  1. When changing the high to low for the direction, I need to upload it twice in order for the motor to change the rotation. Do you think my driver is broken?

Something sounds very wrong. Make sure to change the direction pin, delay for a few microseconds
before the next step pulse (digitalWrite() is actually slow enough to guarantee such a delay). Note
that the step happens on the LOW to HIGH transition of the step pin, the other transition is irrelevant.