How many motors can an L298N control?

I'm currently trying to control 4 motors with 4 button switches using an L298N, Arduino UNO, and 7.2V 1500mA battery. However for some reason only tactPin 2 and 4 are working. Here's the program:

int IN1=8;
int IN2=7;
int ENA=10;
int ENB=11;
int IN3=12;
int IN4=13;
int tactPin1=3;
int tactPin2=5;
int tactPin3=6;
int tactPin4=9;
int ledState1 = HIGH;
int ledState2 = HIGH;
int ledState3 = HIGH;
int ledState4 = HIGH;

void setup()
{
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(tactPin1, INPUT); // Right Side
pinMode(tactPin2, INPUT); // Right Side
pinMode(tactPin3, INPUT); // Left side
pinMode(tactPin4, INPUT); // Left side

}
void loop()
{

if (digitalRead(tactPin1) == HIGH)
{
analogWrite(ENB, 255); // motor speed
digitalWrite(IN3, HIGH); // rotate forward Right side
digitalWrite(IN4, LOW);

}

else if (digitalRead(tactPin1) == LOW)
{
analogWrite(ENB, 0);
digitalWrite(IN3, LOW); // stop Right side
digitalWrite(IN4, LOW);
}
if (digitalRead(tactPin2) == HIGH)
{
analogWrite(ENB, 255);// motor speed
digitalWrite(IN3,LOW);// rotate backward Right side
digitalWrite(IN4,HIGH);
}
else if (digitalRead(tactPin2) == LOW)
{
analogWrite(ENB, 0);
digitalWrite(IN3,LOW); // stop Right side
digitalWrite(IN4,LOW);
}
if (digitalRead(tactPin3) == HIGH)
{
analogWrite(ENA, 255);// motor speed
digitalWrite(IN1,HIGH); // Left Side backward
digitalWrite(IN2,LOW);
}
else if (digitalRead(tactPin3) == LOW)
{
analogWrite(ENA, 0);// motor speed
digitalWrite(IN1,LOW); // Left Side stop
digitalWrite(IN2,LOW);
}
if (digitalRead(tactPin4) == HIGH)
{
analogWrite(ENA, 255);// motor speed
digitalWrite(IN1,LOW); //Moves backward
digitalWrite(IN2,HIGH);
}
else if (digitalRead(tactPin4) == LOW)
{
analogWrite(ENA, 0);// motor speed
digitalWrite(IN1,LOW); // Left Side stop
digitalWrite(IN2,LOW);
}

}

Ignore the led States

It is a dual H-bridge, so two DC motors is the limit if you want bidirectional drive.

Thx

What if you connect 2 more?

You need to tell more.
What motors are those, and how do you imagine to connect them ?
Which way do you like to control these motors ?
What do you expect those motors to do after they have been connected ?

Blazingnite:
What if you connect 2 more?

It's kind of like..... if we have 2 hands, and we're asked to hold 1 thing in each hand (and not let go).

You could put 2 things in one hand..... but whatever you do - such as either raise or lower your hand - both things in that hand will be doing the same thing - you raise the hand.... both objects will be raised (that's if your hand can handle the weight of both objects) - you lower hand ... both objects will be lowered.

So, in terms of 'control'.... you probably can't control both objects in one hand (such as their independent height above the ground). This would be the same for 2 similar motors connected to 1 output. So if your intention is to make both motors sort of do the same thing.... then it's ok to connect both of them - but how fast they can go, and how much torque they produce will depend on how much power your driver can safely output.

2 bidriectionally, 4 unidirectionally, or if you used a dual supply rail, 4 bidirectionally, since you only
need a 1/2 H-bridge for bidirectional control with a dual supply.