RBE1001Lib
|
A Timer that remembers a starting time and interval allow easy periodic events. More...
#include <Timer.h>
Public Member Functions | |
Timer (unsigned long interval) | |
Construct a new Timer object. More... | |
bool | isExpired () |
Checks to see if the timer has expired. More... | |
void | reset () |
Reset the timer to the current time + interval. More... | |
void | reset (unsigned long newInterval) |
Reset the timer with a new interval. More... | |
Private Attributes | |
unsigned long | expiredTime |
unsigned long | timeInterval |
A Timer that remembers a starting time and interval allow easy periodic events.
This class is for simple timing of things in the loop function where it will determine if some amount of time has elapsed. When it is checked after the time has elapsed then the timer is reset to simplify restarting the next interval. Think of printing periodically.
Timer::Timer | ( | unsigned long | interval | ) |
Construct a new Timer object.
interval |
Create a timer that will expire every "interval"
Definition at line 7 of file Timer.cpp.
References expiredTime, and timeInterval.
bool Timer::isExpired | ( | ) |
Checks to see if the timer has expired.
Check if the timer is expired, that is the current time is past the expired time.
Definition at line 35 of file Timer.cpp.
References expiredTime, and timeInterval.
void Timer::reset | ( | ) |
Reset the timer to the current time + interval.
Reset the timer to that the expired time is the current time + interval
Definition at line 16 of file Timer.cpp.
References expiredTime, and timeInterval.
Referenced by reset(), setup(), and updateDashboard().
void Timer::reset | ( | unsigned long | newInterval | ) |
Reset the timer with a new interval.
newInterval |
Change the timer interval to "NewInterval" then reset the timer to that the expired time is the current time + interval
Definition at line 25 of file Timer.cpp.
References reset(), and timeInterval.
|
private |
Definition at line 40 of file Timer.h.
Referenced by isExpired(), reset(), and Timer().
|
private |
Definition at line 41 of file Timer.h.
Referenced by isExpired(), reset(), and Timer().