L298N motor driver board is running only one motor supplied with a 9v battery

its a different layout than the normal red one seen most times, its green, it has a built in servo and a toggle push button.

the motors work and the arduino works too

code i used

int motor = 10;
int notor = 11;
void setup() {
pinMode(10, OUTPUT); //ENA
pinMode(11, OUTPUT); //ENB
pinMode(2, OUTPUT); //INA
pinMode(3, OUTPUT); //INB
pinMode(4, OUTPUT); //INC
pinMode(5, OUTPUT); //IND
  

}

void loop() {
  digitalWrite(motor, HIGH);
  digitalWrite(notor, HIGH);
  digitalWrite(2, HIGH);
  digitalWrite(4,HIGH);
}

the motors dont work and (inc and ind) only work if i press the push button just a bit but not toggle it
5v and ina stay on at all times, dim a bit when inc and d are on. Help?

arduino connected to 4xAA (6v) and driver connected to 9v battery

9V batteries are not suitable for motors. They are really only suitable for smoke detectors. Your 4xAA would be a much better source of power for your motors.

same problem, doesnt work, the 5v and ina leds remain on but dont move, and cd only move when the switch is slightly pushed

i dont really need the batteries to last for long, its a science fair project, just need enough time to showcase it. the judges dont care about practicality really

The inputs (usually labeled IN1 & IN2) have to be different for the motor to run:

  // forward
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
  // reverse
digitalWrite(IN2,LOW);
digitalWrite(IN1,HIGH);

i have done that, pin 2 is ina and pin 4 is inc.

do i have to declare low too?

i got it working

How did you solve the problem?

Tom... :smiley: :+1: :coffee: :australia:

the motors i was using were uni directional, i had made ind on but it doesnt rotate like that, switched m1 to ina and m2 to inc, fixed the problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.