Closed fergu closed 3 years ago
I also need help with this. I am trying to control the speed of stepper motors by using setFrequency on the fly.
@henriksod I ended up doing this by stopping the timer, adjusting the frequency, and restarting the timer like I showed above. It seems to work just fine.
Closing this as that's pretty much the solution I found that worked best.
I have a program where I want to adjust a frequency of the timer on the fly with the output active. Essentially, I am generating a sine wave and need to sweep through a range of frequencies.
An example code would be:
As a general rule, someFreq and someOtherFreq are close to each other (Within 1 hz), and both of them are in the 10-50 Hz range.
I'm not sure if changing frequency with the timer active is just unsupported, but I imagine it should be possible since all that is changing is the overflow counter as I understand it. It's possible that I'm doing something boneheaded as well.