Hello,
I used the Micro:bit with the L298N module to control the wheels of a car. I managed to make my wheels go forward and backward, but I want to know how I can change the speed of my motors using the ENA and ENB pins. Can you help me please?
Hello,
I used the Micro:bit with the L298N module to control the wheels of a car. I managed to make my wheels go forward and backward, but I want to know how I can change the speed of my motors using the ENA and ENB pins. Can you help me please?
Hi @inesfki . Welcome to the forum!
Have you tried the analog write
to a pin(s) that are connected to ENA and ENB?
Analog write isn’t really analog — it’s pulse width modulation (written as PWM). PWM is the technique that is usually used to control speed of an L298.
You may need to try different values for both the analog value (0 is off, 1023 is full power on) and possibly adjust the period with the analog set period
block. You may want to review the datasheet for the L298N. It looks like ST has an “Application Note” on the L298N that has an example with an 18kHZ PWM, which would be a period of 56 microseconds.
It may help to review both data sheets and other examples/advice on electronics forums (or from experts)…and proceed with caution.