L298N Enable Pin

I was facing a problem for a month. I am trying to use L298N card for control my DC motor but when I connect the enable pin to my arduino, motor starts to sound like zz but it doesn't work. When I try use 5V of card to enable pin(short circuit on card) it works well. What should I do for control the card with my arduino?


#define rightmotor1 6 //in3 on pin6 controls one side of motor
#define rightmotor2 7 //in4 on pin7 controls other side of motor
#define rightmotorEn 9 //enB on pin9 controls speed of motor

void setup() {
   //set all outputs
  pinMode(rightmotor1,OUTPUT); 
  pinMode(rightmotor2,OUTPUT);
  pinMode(rightmotorEn,OUTPUT); 

}

void loop() {
  digitalWrite(rightmotor1,HIGH);//Set in3 high for voltage 
  digitalWrite(rightmotor2,LOW);//set in4 low for ground
  analogWrite(rightmotorEn,100);//set pwm control for speed
  
}

(Sorry for the lack of knowledge about forum by the way. I am so beginner.)

How are you driving the pin ?

Please post your complete sketch following the instructions in How to get the best out of this forum regarding formatting and the use of code tags

Include an as-built schematic of you circuit, too.  Hand drawn is OK.

Maybe it helps too.

100, less than half voltage, may not be enough to get the motor moving. Try analogWrite(rightmotorEn,255);

Steve

Not really

tried, same.

How can I contribute to you for better understanding

Sounds like pin9 is toast. I'd double check it can drive an LED+series resistor.

if the Enable from this Module HIGH-Active or LOW-Active?
is it LOW-Active, you Write: analogWrite(rightmotorEn, 0) for enable the motor.
is it HIGH-Active, you write: analogWrite(rightmotorEn, 255) for enable the motor.

It can. checked.

I've tried values, also I tried digitalwrite as well. Same.

If you applied an analogWrite value of 255 and the motor still buzzes, you have a hardware problem. Could be wiring, or could be the power supply is no good.

Where is 5V supplied to the L293D module? I see nothing on the terminal.

I just noticed: I don't see a GND connection between the Arduino and the L293 module. only the + 5V can be seen.
It is essential to connect the GND of the Arduino and the L293 module so that the signals have a reference potential.

I connected. I've must shown in the schematic.

I tested power supply, it works well.

  digitalWrite(rightmotor1,HIGH); //I supply 5V there. Or did I misunderstand your question ?
  digitalWrite(rightmotor2,LOW);
  analogWrite(rightmotorEn,100);

My Friends told me that its about hardware as well. I am going to try another arduino when I go to University.

...and now it works? Doesn't work?

It is always connected. So still doesn't work :sweat:

Define, "doesn't work".

then your photo is faulty, because the GND connection cannot be seen there.