This document was generated from file
timer.h
at 6. 4. 2023 22:35:49
class Timer /* line 30 */
Simple and easy to use timer library
Hallo World example (blinking LED)
#include <Timer.h>
Timer timer(1000);
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
if (timer.elapsed()) {
digitalWrite(LED, ! digitalRead(LED)); // toggle LED
}
}
typedef unsigned long time_ms /* line 41 */
Type of time in miliseconds
Timer(time_ms interval, bool autostop = false) /* line 60 */
Create new timer instance with defined interval
interval
- interval time (in miliseconds)autostop
- indicate if timer should stop after each elapsed
Timer mytimer(5000); // New timer for 5 sec.
bool elapsed() /* line 74 */
Check if set interval elapsed
Return true
if interval epalsed othervise false
void restart() /* line 79 */
Restart timer form begining
void restart(time_ms interval) /* line 88 */
Restart timer form begining and change interval
interval
- interval time (in miliseconds)
time_ms interval /* line 97 */
Timers interval (in miliseconds)