FastPwmPin
FastPwmPin copied to clipboard
Stopping PWM
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
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
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...