// connect motor controller
pins to Arduino digital pins
// motor one
int motorSpeedA = 10;
int motorDirectionAin1 = 9;
int motorDirectionAin2 = 8;
// motor two
int motorSpeedB = 5;
int motorDirectionBin3 = 7;
int motorDirectionBin4 = 6;
void setup() {
// set all the motor control pins to outputs
pinMode(motorSpeedA, OUTPUT);
pinMode(motorSpeedB, OUTPUT);
pinMode(motorDirectionAin1, OUTPUT);
pinMode(motorDirectionAin2, OUTPUT);
pinMode(motorDirectionBin3, OUTPUT);
pinMode(motorDirectionBin4, OUTPUT);
}
void loop() {
digitalWrite(motorDirectionAin1, HIGH);
digitalWrite(motorDirectionAin2, LOW);
digitalWrite(motorDirectionBin3, HIGH);
digitalWrite(motorDirectionBin4, LOW);
analogWrite(motorSpeedA, 250);
analogWrite(motorSpeedB, 250);
delay(1000);
// now turn off motors
digitalWrite(motorDirectionAin1, LOW);
digitalWrite(motorDirectionAin2, LOW);
digitalWrite(motorDirectionBin3, LOW);
digitalWrite(motorDirectionBin4, LOW);
}