Hello,
I am working with a timer, and I want to wait until the timer has finished the current cycle. My code is very simple but doesn't work :-( And of course I don't understand why.
Thanks for your help.
Michel
I am working with a timer, and I want to wait until the timer has finished the current cycle. My code is very simple but doesn't work :-( And of course I don't understand why.
Thanks for your help.
Michel
Code:
#include "TeensyTimerTool.h"
using namespace TeensyTimerTool;
PeriodicTimer myTimer(PIT);
byte TimerEnd;
void printCurrentTime() {
TimerEnd=1;
}
void setup() {
delay(300);
TimerEnd=0;
myTimer.begin(printCurrentTime, 5000ms, true);
}
void loop() {
while (TimerEnd == 0) {
}
Serial.println("1 Cycle executed");
exit(0);
}