Last active
August 29, 2015 14:14
-
-
Save nrbrd/76b9abec96b02da8ae33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TimerObject.h" | |
TimerObject *timer1 = new TimerObject(1000); //use two hours here | |
TimerObject *timer2 = new TimerObject(1000); //use 6 hours | |
TimerObject *timer3 = new TimerObject(1000); //two minutes | |
void setup() { | |
Serial.begin(9600); | |
timer1->setOnTimer(&timer1Callback); | |
timer1->setSingleShot(true); | |
timer2->setOnTimer(&timer2Callback); | |
timer2->setSingleShot(true); | |
timer3->setOnTimer(&timer3Callback); | |
timer3->setSingleShot(true); | |
Serial.println("Turn valv 1 on"); | |
//start valv 1 here! | |
timer1->Start(); | |
} | |
void timer1Callback(){ | |
Serial.println("Turn valv 2 on"); | |
//start valv 2 here!! | |
timer2->Start(); | |
} | |
void timer2Callback(){ | |
Serial.println("Turn valv 3 on"); | |
//start valv 3 here!! | |
timer3->Start(); | |
} | |
void timer3Callback(){ | |
Serial.println("Restarting process..."); | |
Serial.println("Turn valv 1 on"); | |
//start the valv 1 here!! | |
timer1->Start(); | |
} | |
void loop() { | |
timer1->Update(); | |
timer2->Update(); | |
timer3->Update(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment