Hi, I have tired to use three interval timers at the same time on Teensy 4.
However, I only got responses from former two of them (myTimer and myTimer2 in the follwong code).
Could you help me to solve the problem?
However, I only got responses from former two of them (myTimer and myTimer2 in the follwong code).
Could you help me to solve the problem?
Code:
IntervalTimer myTimer;
IntervalTimer myTimer2;
IntervalTimer myTimer3;
void myTimerFunc();
void myTimer2Func();
void myTimer3Func();
int temp = 0;
int temp2 = 0;
int temp3 = 0;
void setup()
{
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
myTimer.begin(myTimerFunc, 2000);
myTimer2.begin(myTimer2Func, 2000);
myTimer3.begin(myTimer3Func, 5000);
}
void loop()
{
}
void myTimerFunc()
{
temp = !temp;
digitalWrite(1, temp);
}
void myTimerFunc2()
{
temp2 = !temp2;
digitalWrite(2, temp2);
}
void myTimerFunc3()
{
temp3 = !temp3;
digitalWrite(3, temp3);
}