I am new to the Arduino stuff and I am using L298N to drive two DC motors. When I searched online for sample code, I noticed that there are two types of design.
One type uses analogWrite(pin, pwmOutput) to control PWM on IN1/IN2 pin to adjust speed, and the other uses digitalWrite(pin, HIGH/LOW) to control IN1/IN2 but use analogWrite(enA, pwmOutput) to control speed.
I guess probably both can work, but I just feel it is not right to apply PWM on the enable pin. Any suggestion from the experts?
One more thing, many people say L298N is obsolete. Would anyone please recommend a replacement motor drive module?