How to Control stepper motor using A4988 driver and Arduino.

CHANGE VALUE  FROM 0-800 TO INCREASE SPEED


Connections A4988 to STEPPER MOTOT

1A=RED WIRE
A2=GREEN WIRE
A3=YELLOW WIRE
A4=BLUE WIRE


CODES

 #include <AccelStepper.h>

AccelStepper stepper(AccelStepper::FULL2WIRE, 4, 3);  // 4-STEP AND 16-DIRECTION


void setup()

{  

   stepper.setMaxSpeed(1000);  //THIS SHOWS MAX SPEED(RPM) - 1000

   stepper.setSpeed(500); // CHANGE VALUE FROM 0-800 TO INCREASE SPEED

}


void loop()

{  

   stepper.runSpeed(); //THIS RUN THE MOTOR AT CONSTANT SPEED

}

Post a Comment

0 Comments