EmbeddedRelated.com
Forums

How To Control Stepper Motor with A4988 Driver and Dynamic C ?

Started by "kar...@yahoo.com [rabbit-semi]" June 9, 2017
Here is the A4988 board for Arduino example code, I would like to consult how to apply in Dynamic C ?
int dirPin = 8;
int stepperPin = 7;
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepperPin, OUTPUT);
}
void step(boolean dir,int steps){
digitalWrite(dirPin,dir);
delay(50);
for(int i=0;i digitalWrite(stepperPin, HIGH);
delayMicroseconds(800);
digitalWrite(stepperPin, LOW);
delayMicroseconds(800);
}
}
void loop(){
step(true,1600);
delay(500);
step(false,1600*5);
delay(500);
}