

//Motor 1
const int motor1Pin1 = 9;
const int motor1Pin2 = 8;
//Motor 2
const int motor2Pin1 = 7;
const int motor2Pin2 = 6;
int speed = 180;
void setup() {
//Set pins as outputs
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
//Motor Control A in both directions
analogWrite(motor1Pin1, speed);
delay(2000);
analogWrite(motor1Pin1, 0);
delay(200);
analogWrite(motor1Pin2, speed);
delay(2000);
analogWrite(motor1Pin2, 0);
//Motor Control B in both directions
analogWrite(motor2Pin1, speed);
delay(2000);
analogWrite(motor2Pin1, 0);
delay(200);
analogWrite(motor2Pin2, speed);
delay(2000);
analogWrite(motor2Pin2, 0);
}
void loop() {
}
pont_h_l298n.pdf