airpanther
Active member
Hello,
I have a program that runs well, but becomes unresponsive at random intervals. Sometimes within 4 hours, sometimes within 30 minutes. I'd like to use a watchdog to reset the program when it becomes unresponsive, but for some reason, it isn't working for me on Teensy 4.1 I used the Blink example just to see if the board would reset after 4 seconds, but it never resets. I've also tried adding a while(1) loop to see if the watchdog will trigger, but no luck. Any suggestions?
Thanks,
Robert
I have a program that runs well, but becomes unresponsive at random intervals. Sometimes within 4 hours, sometimes within 30 minutes. I'd like to use a watchdog to reset the program when it becomes unresponsive, but for some reason, it isn't working for me on Teensy 4.1 I used the Blink example just to see if the board would reset after 4 seconds, but it never resets. I've also tried adding a while(1) loop to see if the watchdog will trigger, but no luck. Any suggestions?
Code:
#include <avr/wdt.h>
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
wdt_enable(WDTO_4S);
wdt_reset();
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Thanks,
Robert