arunkrishnan
Member
Hi,
I am try to run a 5mS Timer with the IntervalTimer.h in Teensy4.1
I am listening to serial port characters for begin/end timer.
#define testTimerInterval 5000 // Timer Interval for PID loop in microsceconds 100-100uS 1000 - 1mS 10000 - 10 mS 100000 - 100mS
void processSerial() {
if (Serial.available() > 0) {
char commandCharacter = Serial.read(); //we use characters (letters) for controlling the switch-case
switch (commandCharacter) //based on the command character, we decide what to do
{
case 's':
testTimer.end();
break;
case 'S
testTimer.begin(TimerLoop, testTimerInterval); // Timer interval in microseconds 100000 = 100 mS; 1000 = 1mS
break;
}
And my timerloop is given below:
void TimerLoop() {
Serial.println("Test");
}
The issue I am facing is that when I press the 'S' and 's' characters alternatively to start and stop the timers , the code gets hanged and Teensy gets restarted after a few tries.
I can I solve this issue?
I am try to run a 5mS Timer with the IntervalTimer.h in Teensy4.1
I am listening to serial port characters for begin/end timer.
#define testTimerInterval 5000 // Timer Interval for PID loop in microsceconds 100-100uS 1000 - 1mS 10000 - 10 mS 100000 - 100mS
void processSerial() {
if (Serial.available() > 0) {
char commandCharacter = Serial.read(); //we use characters (letters) for controlling the switch-case
switch (commandCharacter) //based on the command character, we decide what to do
{
case 's':
testTimer.end();
break;
case 'S
testTimer.begin(TimerLoop, testTimerInterval); // Timer interval in microseconds 100000 = 100 mS; 1000 = 1mS
break;
}
And my timerloop is given below:
void TimerLoop() {
Serial.println("Test");
}
The issue I am facing is that when I press the 'S' and 's' characters alternatively to start and stop the timers , the code gets hanged and Teensy gets restarted after a few tries.
I can I solve this issue?