Problem using 2 motors I would like both the motors to spin the attached wheels forward when I push the joystick forward and vice versa. When the joystick is still, the motors should stop spinning. At the moment, when I push the joystick on x-axis and my x variable increases both motors spin, but when I push it in the opposite direction and x decreases, only motor A spins. Additionaly when I connect the arduino to the power (usb cable to my pc), motor B spins for approx 1 second and then stops.
This is the circuit I have (sorry for a lack of schematic, let's hope this wonderful drawing is enough):

The code:
int MotorAA = 7;
int MotorAB = 8;

int MotorBA = 11;
int MotorBB = 12;

int x = 0;

void setup() {
  Serial.begin(9600);
  
  
  pinMode(MotorAA, OUTPUT);
  pinMode(MotorAB, OUTPUT);

  pinMode(MotorBA, OUTPUT);
  pinMode(MotorBB, OUTPUT);


  digitalWrite(MotorAA, LOW);
  digitalWrite(MotorAB, LOW);

  digitalWrite(MotorBA, LOW);
  digitalWrite(MotorBB, LOW);
}

void loop() {
  x = analogRead(A0);
  Move();
  Serial.println(x);
}

void Move() {
  if (x == 0){
    return;
  }
  
  if (x &gt; 520)
  {
    digitalWrite(MotorAA, HIGH);
    digitalWrite(MotorAB, LOW);

    digitalWrite(MotorBA, HIGH);
    digitalWrite(MotorBB, LOW);
  }
  else if (x &lt; 480)
  {
    digitalWrite(MotorAA, LOW);
    digitalWrite(MotorAB, HIGH);
    
    digitalWrite(MotorBA, LOW);
    digitalWrite(MotorBB, HIGH);
  }
  else{
    digitalWrite(MotorAA, LOW);
    digitalWrite(MotorAB, LOW);

    digitalWrite(MotorBA, LOW);
    digitalWrite(MotorBB, LOW);
  }
}
The Arduino can definitely not power that many motors. The Arduino's max output current is 0.1A and you might be drawing around 0.5A. Use an external battery like a LiPo battery for the motor controller.
NOTE: Please watch out! Drawing that many amps from Arduino can kill it! So please use the LiPo or normal batteries!