#include <OzTimer.h> #include <OzIDManager.h> OzIDManager* manager; OzTimer* timer; // save indexes for virtual timers uint8_t i1, i2, i3, i4; // Function called // when last timer expires void sayFinished() { Serial.println("Timers finished."); } void setup() { Serial.begin(115200); manager = new OzIDManager(); manager->_sendACK = false; manager->_checksum = false; OzCommunication::setIDManager(manager); timer = new OzTimer(); // Timer subscription with callback function // 5000 millisecs i1 = timer->addTimerMillisec(5000, "test_1"); // 6000 millisecs i2 = timer->addTimerMillisec(6000, "test_2"); // 65000 millisecs i3 = timer->addTimerString("1:5:0:0", "test_3"); // Runs sayFinished() after 72000 millisecs i4 = timer->addTimerString("1:10:1000:1000000", "test_4", sayFinished); int x = 1; manager->sendLinkSetup(); manager->PrintWelcomeLine(timer, x++, "MyTimers"); } void loop() { OzCommunication::communicate(); OzTimer::loop(); }
More information