// Motor A pins
const int AIN1 = 5;
const int AIN2 = 6;

// Motor B pins
const int BIN1 = 9;
const int BIN2 = 10;

// STBY pin
const int STBY = 4; // You can use any free pin

void setup() {
  pinMode(AIN1, OUTPUT);
  pinMode(AIN2, OUTPUT);
  pinMode(BIN1, OUTPUT);
  pinMode(BIN2, OUTPUT);
  pinMode(STBY, OUTPUT);

  digitalWrite(STBY, HIGH); // Enable motor driver
}

void loop() {
  // Motor A forward
  analogWrite(AIN1, 200);
  analogWrite(AIN2, 0);

  // Motor B backward
  analogWrite(BIN1, 0);
  analogWrite(BIN2, 200);

  delay(2000);

  // Stop both motors
  analogWrite(AIN1, 0);
  analogWrite(AIN2, 0);
  analogWrite(BIN1, 0);
  analogWrite(BIN2, 0);

  delay(1000);

  // Motor A backward
  analogWrite(AIN1, 0);
  analogWrite(AIN2, 200);

  // Motor B forward
  analogWrite(BIN1, 200);
  analogWrite(BIN2, 0);

  delay(2000);

  // Stop both again
  analogWrite(AIN1, 0);
  analogWrite(AIN2, 0);
  analogWrite(BIN1, 0);
  analogWrite(BIN2, 0);

  delay(1000);
}