L298 Motor drive stalls when I use analogWrite

Hi All!

Thanks for the awesone forum!
Via an other topic I discovered the L298 as a solution for my DC motor project.
I followed this article the get it running: https://hardwarefun.com/tutorials/controlling-speed-of-dc-motors-using-arduino

But now, when I use

analogWrite(motor2Ena, 255);

to enable the engine to run, it runs very slow (stalls often). While doing a digital write on the same pin lets the motor run very fast...

digitalWrite(motor2Ena, HIGH);

As I understood, analog 255 should be continuous on, so theoretically as fast as digital HIGH.

Seems very odd, like perhaps there are some other changes in the code. Please post the complete code.

E.g. are you sure you're using a PWM-enabled pin? And it is set as OUTPUT? What do you see with different values in the analogWrite() e.g 80, 120, 180 ?

Steve

Please post your full sketch, snippets like this aren't usually the cause of the problem.

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