Skip to content

LuKks/arduino-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Delay without blocking (timers)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages