Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a real need to use an interrupt to switch to the next frequency? #2

Open
John-Lluch opened this issue Nov 14, 2021 · 0 comments

Comments

@John-Lluch
Copy link

You use an interrupt to determine the time to change to the next frequency. However the actual frequency change is performed on the main loop. I understand interrupts are used to get a precise 'interrupt_time' of 10 ms intervals to set the next frequency.

However I think that given how it works you should be able to do the same by just storing the last millis() as a multiple of 'interrupt_time' and checking whether the next millis() multiple is greater than that. I think it works the same as the 'fired' variable in your code because millis() value is interrupt-generated anyway.

That approach would greatly simplify the code and make it more portable. Does this make sense to you?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant