5
// disable motor output by setting all INx pins high
digitalWrite(in1, HIGH);
digitalWrite(in2, HIGH);
digitalWrite(in3, HIGH);
digitalWrite(in4, HIGH);
}
void loop() {
digitalWrite(in1, LOW); // Turn on motor A in direction 1
delay(2000);
digitalWrite(in1, HIGH); // Turn off motor A in direction 1
digitalWrite(in2, LOW); // Turn on motor A in direction 2
delay(2000);
digitalWrite(in2, HIGH); // Turn off motor A in direction 2
digitalWrite(in3, LOW); // Turn on motor B in direction 1
delay(2000);
digitalWrite(in3, HIGH); // Turn off motor B in direction 1
digitalWrite(in4, LOW); // Turn on motor B in direction 2
delay(2000);
digitalWrite(in4, HIGH); // Turn off motor B in direction 2
}
2-Phase Stepper Motor
This demo will test the motor controller board by running a connected stepper motor in
each direction for a full revolution.
See whadda.com for the manual which includes a wiring diagram
*/
// Include the Arduino Stepper Library
#include <Stepper.h>
// Number of steps per output rotation