Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.16 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.16 KB

arduino-timer

Timers without blocking in 50 lines for Arduino.

examples/set.ino
#include <Timer.h>
Timer Timer;

enum {
  tMessage = 0,
  tLed,
  tUpdate
};

void setup() {
  Serial.begin(9600);
  Serial.println("init");
}

void loop() {
  if(Timer.seconds(tMessage, 1)) {
    Serial.println("every 1s (message)");
  }
  
  if(Timer.set(tLed, 1000)) { //millis
    Serial.println("every 1s (led)");
  }

  if(Timer.micro(tUpdate, 1000000)) {
    Serial.println("every 1s (update)");
  }
}

Install

Download ZIP
In Arduino IDE go to: Sketch -> Include Library -> Add .ZIP library

Description

Native delay(ms) is normally useless, specially for multi timing.
Timer gives control with set, is, clear, exists and left*.
Precision at microseconds.
Aware of overflow.

License

Code released under the MIT License.