FastPwmPin icon indicating copy to clipboard operation
FastPwmPin copied to clipboard

Stopping PWM

Open lekrom opened this issue 3 years ago • 6 comments

Hi @maxint-rd,

Nice lib. Well done. I do have a suggestion. I think it would be useful to provide a function to disable the pwm once started since setting duty to 0 is not supported. I can do it manually but this is not very friendly to folks without in depth knowledge of the mcu control registers.

-regards, Lekrom

lekrom avatar Apr 26 '22 04:04 lekrom

Hello @lekrom,

Thank you for your kind words and your suggestion. Although I haven't had the need for it in my own projects, I think this is a good suggestion. Perhaps using digitalWrite(pin, false) will also disable the signal, but I haven't tested that.

I've marked your issue as an enhancement and will not close it until I made an update or documented another easy way to stop the PWM signal.

Kind regards, Maxint

maxint-rd avatar Apr 26 '22 05:04 maxint-rd

digitalWrite might do the trick. I wil verify. I see in the core code that it turns off pwm if a PWM enabled pin is used. Did not occur to me to check...

lekrom avatar Apr 26 '22 05:04 lekrom