My stepper motor turn just in one direction

Hello,

As your code is written now it is only going to go in one direction. If you want your stepper motor to go in both directions, you should change one of your digitalWrite(dirPin,HIGH); statements to digitalWrite(dirPin,LOW);.

By the way, your VREF voltage is set too high for the DRV8825, The VREF voltage should be no higher than 0.75V if you are using our DRV8825 carrier without additional cooling (e.g. forced airflow or heatsinks). You can see more about setting the current limit for the DRV8825 in the “Current limiting” section of its product page.

-Derrill