3

I want to generate a PWM signal that I can turn on and off with a button press without using interrupts. Is there a way to keep the PWM output going while running other processes?

1 Answers1

4

PWM just runs once started. It's all managed by a completely separate bit of silicon inside the chip.

Once you have done analogWrite(...) the PWM will just keep going until you tell it otherwise.

Majenko
  • 105,095
  • 5
  • 79
  • 137
  • I was running this with Serial plotter yesterday and for some reason it kept interrupting the PWM when I was reading one of the analog channels. I finally tested on an oscilloscope and it does work. Thanks! –  May 12 '16 at 17:41