programming with stepper motor

Good afternoon,

I'm doing a project with stepper motor and arduino and needed some help, I need my stepper motor 90 and rotate the schedule I'm using is this:

digitalWrite(motorPin1, HIGH); delay(delayTime); digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); delay(delayTime); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, HIGH); delay(delayTime); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); delay(delayTime); digitalWrite(motorPin4, LOW);

Only my stepper motor is 1.8 degrees / step and for it to turn 90 degrees I would need roughly 12x that schedule these q above, but would be very extensive, would have a way to make this programming q repeat 12x without copies it be 12x?

Thank you in advance

would have a way to make this programming q repeat 12x without copies it be 12x?

Use the Stepper library.

Stepper myStepper(/* appropriate pin numbers go here */);
myStepper.step(asManyTimesAsYouWant);

You could also use a FOR loop

for (numSteps = 0; numSteps < 50; numSteps ++) {
   digitalWrite(motorPin1, HIGH);
         // a delay is unlikely to be needed here, and if it is, just a few microseconds
   digitalWrite(motorPin1, LOW); 
   delay(delayTime);
}

FOR loops are very very useful for all sorts of things.

…R

Cross posting: http://forum.arduino.cc/index.php?topic=263635.0