I am working on a Data Logger/GPS wayfinder using the Teensy 3.2, that uses LED buttons as the interface for letting the user know what state the Data Logger is in at any given time, i.e.
blinking one LED fast = currently logging
blinking a different LED = something else
etc...
I am currently using the Metro library or millis() to manage the blinking rates, but I am continuously having to poll for an updated time, to determine whether to turn on or off the LED's, and this leads to gaps in timing, which leads to erratic blinking.
I would like the LED's to blink at whatever rate I set for them regardless of what other functions I am executing at any given time (within human perceivable limits of course, I know that nothing is simultaneous), and be able to change that rate at different points in my program to suit the desired LED blink rate.
Which leads me to the possibility of using timer interrupts or other interrupts to accomplish the task.
Looking at the example given on this page: https://www.pjrc.com/teensy/td_timing_IntervalTimer.html I can see how setting up a timer to blink an LED at a given rate might work out well, but it is unclear if using this method will allow me to change the interval during the course of my program, and how to accomplish this.
Can I call this method at any point in my program to change the timer settings? Or can it only be set once at the beginning?
myTimer.begin(blinkLED, 150000);
If so, then this seems to be the clearest path. If not, then I'll need to find another way.
In general, am I on the right track in thinking that interrupts are the way to proceed?
Thanks in advance for any help and advice.
blinking one LED fast = currently logging
blinking a different LED = something else
etc...
I am currently using the Metro library or millis() to manage the blinking rates, but I am continuously having to poll for an updated time, to determine whether to turn on or off the LED's, and this leads to gaps in timing, which leads to erratic blinking.
I would like the LED's to blink at whatever rate I set for them regardless of what other functions I am executing at any given time (within human perceivable limits of course, I know that nothing is simultaneous), and be able to change that rate at different points in my program to suit the desired LED blink rate.
Which leads me to the possibility of using timer interrupts or other interrupts to accomplish the task.
Looking at the example given on this page: https://www.pjrc.com/teensy/td_timing_IntervalTimer.html I can see how setting up a timer to blink an LED at a given rate might work out well, but it is unclear if using this method will allow me to change the interval during the course of my program, and how to accomplish this.
Can I call this method at any point in my program to change the timer settings? Or can it only be set once at the beginning?
myTimer.begin(blinkLED, 150000);
If so, then this seems to be the clearest path. If not, then I'll need to find another way.
In general, am I on the right track in thinking that interrupts are the way to proceed?
Thanks in advance for any help and advice.