hi again,
sorry ignore the previous code, i am using the below code
const int stepPin1 = 2;
const int dirPin1 = 5;
const int stepPin2 = 3;
const int dirPin2 = 6;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin1,OUTPUT);
pinMode(dirPin1,OUTPUT);
pinMode(stepPin2,OUTPUT);
pinMode(dirPin2,OUTPUT);
}
void loop() {
digitalWrite(dirPin1,HIGH); // X FRD 1
for(int x = 0; x < 500; x++) {//X FRD 1
digitalWrite(stepPin1,HIGH); //X FRD 1
delayMicroseconds(1000); //X FRD 1
digitalWrite(stepPin1,LOW); //X FRD 1
delayMicroseconds(1000);//X FRD 1
}
delay(200); // One second delay 1
//X FORWARD END BLOCK 1
digitalWrite(dirPin1,LOW); // X REV 1
for(int x = 0; x < 500; x++) {//X REV 1
digitalWrite(stepPin1,LOW); //X REV 1
delayMicroseconds(1000.2); //X REV 1
digitalWrite(stepPin1,HIGH); //X REV 1
delayMicroseconds(1000.2);//X REV 1
}
delay(100); //X REV 1
//X REVERSE END
digitalWrite(dirPin2,LOW); //Y 1
for(int x = 0; x < 400; x++) {//Y 1
digitalWrite(stepPin2,LOW);//Y 1
delayMicroseconds(1000);//Y 1
digitalWrite(stepPin2,HIGH);//Y 1
delayMicroseconds(1000);//Y 1
}
delay(100);//Y REV
//Y FORWARD 1 END
digitalWrite(dirPin1,HIGH); // X FRD 2
for(int x = 0; x < 500; x++) {//X FRD 2
digitalWrite(stepPin1,HIGH); //X FRD 2
delayMicroseconds(1000); //X FRD 2
digitalWrite(stepPin1,LOW); //X FRD 2
delayMicroseconds(1000);//X FRD 2
}
delay(100); // One second delay 2
//X FORWARD END BLOCK 2
digitalWrite(dirPin1,LOW); // X REV 2
for(int x = 0; x < 500; x++) {//X REV 2
digitalWrite(stepPin1,LOW); //X REV 2
delayMicroseconds(1000.4); //X REV 2
digitalWrite(stepPin1,HIGH); //X REV 2
delayMicroseconds(1000.4);//X REV 2
}
delay(100); //X REV 2
//X REVERSE 2 END
digitalWrite(dirPin2,LOW); //Y 2
for(int x = 0; x < 400; x++) {//Y 2
digitalWrite(stepPin2,LOW);//Y 2
delayMicroseconds(1000);//Y 2
digitalWrite(stepPin2,HIGH);//Y 2
delayMicroseconds(1000);//Y 2
}
delay(100);//Y REV
//Y FORWARD 2 END
digitalWrite(dirPin1,HIGH); // X FRD 3
for(int x = 0; x < 500; x++) {//X FRD 3
digitalWrite(stepPin1,HIGH); //X FRD 3
delayMicroseconds(1000); //X FRD 3
digitalWrite(stepPin1,LOW); //X FRD 3
delayMicroseconds(1000);//X FRD 3
}
delay(100); // One second delay 3
//X FORWARD END BLOCK 3
digitalWrite(dirPin1,LOW); // X REV 3
for(int x = 0; x < 500; x++) {//X REV 3
digitalWrite(stepPin1,LOW); //X REV 3
delayMicroseconds(1001); //X REV 3
digitalWrite(stepPin1,HIGH); //X REV 3
delayMicroseconds(1001);//X REV 3
}
delay(100); //X REV 3
//X REVERSE 3 END
digitalWrite(dirPin2,HIGH); //Y rev
for(int x = 0; x < 1000; x++) {//Y rev
digitalWrite(stepPin2,HIGH);//Y rev
delayMicroseconds(1000);//Y rev
digitalWrite(stepPin2,LOW);//Y rev
delayMicroseconds(1000);//Y rev
}
delay(100);//Y REV
//Y FORWARD 2 END
for(;;){}
}