项目作者: LuKks

项目描述 :
Delay without blocking (timers)
高级语言: C++
项目地址: git://github.com/LuKks/arduino-timer.git
创建时间: 2019-01-13T19:37:20Z
项目社区:https://github.com/LuKks/arduino-timer

开源协议:MIT License

下载


arduino-timer

Timers without blocking in 50 lines for Arduino.

examples/set.ino
  1. #include <Timer.h>
  2. Timer Timer;
  3. enum {
  4. tMessage = 0,
  5. tLed,
  6. tUpdate
  7. };
  8. void setup() {
  9. Serial.begin(9600);
  10. Serial.println("init");
  11. }
  12. void loop() {
  13. if(Timer.seconds(tMessage, 1)) {
  14. Serial.println("every 1s (message)");
  15. }
  16. if(Timer.set(tLed, 1000)) { //millis
  17. Serial.println("every 1s (led)");
  18. }
  19. if(Timer.micro(tUpdate, 1000000)) {
  20. Serial.println("every 1s (update)");
  21. }
  22. }

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.