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.
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
Gateway without a radio
Development • 12 Jan 2025, 23:19 • OldSurferDude 14 Jan 2025, 22:07 -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
MYSController with MQTT Gateway (via Node Red)
Development • 11 Aug 2024, 22:35 • slt1 11 Aug 2024, 22:35 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51