I have DC motor controlled by H-bridge and two outputs. I am using digital outputs so motor controlled with full voltage range. It works fine, but I would like to migrate to use PWM to be able to control rotation speed.
I did now with this logic:
If motor stops: both outpups set PWM to sero.
If motor rotates: one output (depends on direction) sets PWM to zero, the other one with desired PWM to rotate.
Seems like it is also working, but in some code samples (in TI products, not really Arduino related) I saw the other logic: instead of setting PWM to zero, they are switching pin mode back do digital output and set it to logical "LOW".
Is it not the same?
How should I properly control these two outputs with PWM?
What is the "Coasting mode" in this context?