Hi,
I've been working on a project where I need the pwm to vary after 1 second intervals depending on the serial input coming in. I don't really like using delays all over the code and was thinking of using timer interrupts.
So my question is : If I raise a timer interrupt using timer 1 on the 328p or 32u4, can I vary the PWM in the ISR using timer 2?
Alternatively, if I'm missing out a really easy solution on how to change pwm values at one second intervals without using the delay, please let me know. The values ramp up at one second intervals for a certain number of seconds (varies according to mode) and then ramps down over a few more seconds (again variable) sort of trying to create a pulsating effect while the mode or set points can change at any time. So it can't be in something like a simple for loop. Based on serial inputs, the pwm set points, and other variables will be varying.
I hope I've done a half decent job of trying to explain the issue I'm facing. The pwm frequency doesn't matter as long as it is under 10k.