Usage:
- run function blinkLED() every 2000 ms:
timer.addEverytime(2000, blinkLED);

- run function itWorks() two times with interval 2000 ms, wait 300 ms before first start:
timer.addTask(2000, 2, 300, itWorks);

Removing a task:
removeEverytime(callback_function);
removeTask(callback_function);

Library can also be used in desktop C++ applications:
#include <iostream>
#include <string>
#include <chrono>
#include <thread>
#include "RZtimer.h"
int main()
{
RZTimer timer;
timer.addEverytime(2000, [] (){ std::cout << "Hello! " << std::chrono::duration_cast<std::chrono::milliseconds >(
std::chrono::system_clock::now().time_since_epoch()
).count() << "\n";});
while(1){
timer.run();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}

Project Samples

Project Activity

See All Activity >

Categories

Libraries

Follow Arduino Timer Library RZtimer

Arduino Timer Library RZtimer Web Site

Other Useful Business Software
Get Avast Free Antivirus with 24/7 AI-powered online scam detection Icon
Get Avast Free Antivirus with 24/7 AI-powered online scam detection

Get protection for today’s online threats. Free.

Award-winning antivirus protection, as well as protection against online scams, dangerous Wi-Fi connections, hacked accounts, and ransomware. It includes Avast Assistant, your built-in AI partner, which gives you help with suspicious online messages, offers, and more.
Free Download
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Arduino Timer Library RZtimer!

Additional Project Details

Programming Language

C++

Related Categories

C++ Libraries

Registered

2018-08-24