A4988 Stepper Driver on Uno — Arduino Uno simulation

Arduino Uno driving a stepper motor through an A4988 driver on a breadboard.

An interactive Arduino Uno circuit simulation you can run free in your browser on Velxio, by tarunsssuhe.

Components

Sketch code

int stepPin = 3;
int dirPin = 2;

int stepsperRevalution = 200;

int dt (2000);

void setup() {
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
 
int (dt);



}

void loop() {
digitalWrite(dirPin,HIGH);

for(int i = 0; i<stepsperRevalution;i++){
digitalWrite(stepPin, HIGH);
delayMicroseconds(5000);
digitalWrite(stepPin, LOW);
delayMicroseconds(5000);
}
delay(1000);
digitalWrite(dirPin, LOW);
for(int i = 0; i<stepsperRevalution/2;i++){
digitalWrite(stepPin, HIGH);
delayMicroseconds(5000);
digitalWrite(stepPin, LOW);
delayMicroseconds(5000);
}
  
   
  }

More projects by tarunsssuhe