Please remove the jumper from ENA & ENB, ENA & ENB is then connected to Digital 9 and Digital 10 respectively. Sketch below control the speed of two DC motors.
#L298n motor driver board arduino sketch code
Code below is the Arduino sketch that control two motors at a constant speed. The above connections and methods can be applied to controlling the second DC motor.īy connecting the L298N Motor Driver Controller Board to an Arduino, you can control two DC motors. In certain circumstances, ENA is connected to a non-PWM digital output of the micro-controller in order to stop the motor slowly. In order to control the speed of the motor, the jummper must removed from EnA, then connect it to PWM capable digital output of a micro-controller. Set both In1 & In2 to LOW make the motor stop immediately.ĮNA is HIGH by default that make the motor running at a constant speed.
Set In1=HIGH and In2=LOW cause the motor to go forward, reverse the input signal (In1=LOW, In2=HIGH) cause the motor to go backward. The first DC motor is connected to Out1 and Out2 of the Motor Driver Controller Board which is controlled by In1 & In2. Note: There is a voltage drop between the input voltage and the L298’s motor outputs, you can expect a 1V to 3V drop depend on the input voltage and current draw. L=Low, H=High, X=Don’t care, Z=High impedance, Vin=Input voltage, Vdrop=Voltage drop The onboard 78M05 linear regulator provided a stable 5V (up to 0.5A) that can be used to power the L298N H-bridge and other parts. Control signal input level: High level 2.3V Maximum power dissipation: degree Celsius.Driver input voltage: 5V~35V (or 7V~35V depending on power supply needs).Controls 2 DC motors max per DC motor, or one stepper motor.