5/15/2023 0 Comments Watchdog government example![]() I've never tried but I presume it would be fairly easy to just count the number of reset interrupts with the WDE set to 0 (reset off), there may be a conflict if your board freezes and cant alter the count value but its a theoretical guess. doggieTickle() // if you uncomment this line, it will keep resetting the timer. Serial.println("In loop waiting for Watchdog") Serial.println("Howdy") // be removed also resetFunc() // This will call location zero and cause a reboot. Serial.println("This is where it would have rebooted") // just here for testing Void(* resetFunc) (void) = 0 //declare reset function address 0 #define doggieTickle() resetTime = millis() // This macro will reset the timer ![]() it's not limited to 8 seconds like the normal #define TIMEOUTPERIOD 10000 // You can make this time as long as you want, Here's the code if you want to include it at some point or just to expand your example. I still can't use WDE, but that problem is easy to work around. This is exactly the solution I needed to free up timer three and put the job back on the watchdog like it should be. Well, your description got me to thinking and I came up with a solution that uses the watchdog AND allows me to have a much longer watchdog timer. That was not a very satisfactory solution especially since the watchdog should be able to do this job. That meant that I had to fake a watchdog using timer 3 on the board. ![]() The board would hang up in a loop, requiring a power cycle to recover. As the post above may have indicated, I've been avoiding the wdt on the mega 2560 board because the bootloader doesn't initialize it properly.
0 Comments
Leave a Reply. |