Watchdog timer
-
How do I add a watchdog timer to my motion sensor sketch?
I can get an example watchdog timer sketch to work, and it resets if wdt is not rest in the loop, but I cannot get it work in the motion sensor sketch.
-
@igpels-gurrala Could you show us your code. Maybe we can figure out what is wrong.
-
If you have a battery motion sensor I don't think you can effectively run a watchdog
-
Hi,
In MySensors:
- if you use deep power down, sleep() without time, it doesn't use watchdog, and can be waken up by a pin interrupt only.
- if you use sleep(ms) it uses watchdog.
- during runtime, watchdog is enabled, and it resets at each loop().
-
@dbemowsk https://hastebin.com/ilonemimev.cpp
I am using an arduino nano plugged into a 5V phone charger. I can get the watchdog working on its own. But, not when I put the rest of the motion sensor sketch with it.
-
there is no real need to sleep a mains powered sensor
-
@gohan I removed the sleep portion, but still can't get the watchdog to trigger a reset
https://hastebin.com/xeqavitadu.cpp
-
try adding a 10 seconds delay before resetting the wtd timer, it should trigger
-
@gohan Yep, that did it. Thank you so much.