Hey guys, a newby here,
I am new to this forum and posting my first query regarding the stepper motor and big easy driver.
I want to rotate the stepper motor to a particular steps say 1000(CW&CCW) then with a delay of 2 seconds then to different number of steps say 1600(CW&CCW) and then back to 1000 and so on in a loop.
I am new to the programming so I took some lessons from youtube and connected my BED's DIR and STEP pins to 8 and 9 on arduino and powered the 24v to the motor.
This program works good for only one defined steps. Tried some experimenting with creating another loop but the motor won't run. If anyone can help me with the code, i'd be obliged
int Distance = 0;
void setup() {
pinMode (8, OUTPUT);
pinMode (9, OUTPUT);
digitalWrite (8, LOW);
digitalWrite (9, LOW);
}
void loop () {
digitalWrite (9, HIGH);
delayMicroseconds (350); //time to reach to that position
digitalWrite (9, LOW);
delayMicroseconds (350);
Distance = Distance + 1; //records this step
//check to see if we are end of our move
if (Distance == 1000) { //you can change the number of steps to adjust the appropriate angle, here it is approx 60deg
if (digitalRead(8) == LOW) {
digitalWrite(8, HIGH);
}
else {
digitalWrite(8, LOW);
}
Distance = 0; //reset the distance
delay(1000); //time delay between the opposite direction
}
}