how to write codes to move both motor for example yand z axis at same with the follo 4951816
How to write codes, to move both motor, for example yand z axis at same with the following codes, in other wordsSimultaneously) and the function to stop the loop at theend. #include
const int Z_stepPin = 9;
const int Y_stepPin = 7;
const int X_stepPin = 11;
const int Z_dirPin = 8;
const int Y_dirPin = 6;
const int X_dirPin = 12; void setup() {
pinMode(Z_stepPin,OUTPUT);
pinMode(Y_stepPin,OUTPUT);
pinMode(X_stepPin,OUTPUT);
pinMode(Z_dirPin,OUTPUT);
pinMode(Y_dirPin,OUTPUT);
pinMode(X_dirPin,OUTPUT);
digitalWrite(Z_stepPin,LOW);
digitalWrite(Y_stepPin,LOW);
digitalWrite(X_stepPin,LOW);
digitalWrite(Z_dirPin,LOW);
digitalWrite(Y_dirPin,LOW);
digitalWrite(X_dirPin,LOW);
}
void loop() { digitalWrite(X_dirPin,LOW); // anticlockwise direction 1
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000);
digitalWrite(Z_dirPin,LOW); // anticlockwise direction 2
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,HIGH); // anticlockwise direction 3
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); digitalWrite(Y_dirPin,HIGH); // clockwise driection 4
for(int x = 0; x
digitalWrite(Y_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Y_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); digitalWrite(Z_dirPin,HIGH); // anticlockwise direction 5
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,LOW); // anticlockwise direction 6
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); // Half second delay digitalWrite(Z_dirPin,HIGH); // anticlockwise direction 7
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,HIGH); // anticlockwise direction 8
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); digitalWrite(X_dirPin,LOW); // anticlockwise direction 1
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000);
digitalWrite(Z_dirPin,LOW); // anticlockwise direction 2
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,HIGH); // anticlockwise direction 3
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); digitalWrite(Y_dirPin,LOW); // clockwise driection 4
for(int x = 0; x
digitalWrite(Y_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Y_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); digitalWrite(Z_dirPin,LOW); // anticlockwise direction 5
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,LOW); // anticlockwise direction 6
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); // Half second delay digitalWrite(Z_dirPin,HIGH); // anticlockwise direction 7
for(int x = 0; x
digitalWrite(Z_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(Z_stepPin,LOW);
delayMicroseconds(740);
}
delay(1000); digitalWrite(X_dirPin,HIGH); // anticlockwise direction 8
for(int x = 0; x
digitalWrite(X_stepPin,HIGH);
delayMicroseconds(2);
digitalWrite(X_stepPin,LOW);
delayMicroseconds(750);
}
delay(1000); } Attached