This is a small hint, how to add a watch-dog to your Arduino application.
I’m using the Arduino in 24/7 mode in my weather station. For unknow reason the software sends no data to our host system, it got stucked somewhere. So I added the watch-dog to prevent this.
Adding this functionality is fairly simple.
1. you need to include the wdt.h File:
2. in the setup routine you add:
WDT0_2S means, that the time out is 2s. so you have to reset the watch-dog within that period, otherwise it will reset the complete Arduino microcontroller.
other values are also possible: 15 ms, 30 ms, 60 ms, 120 ms, 250 ms, 500 ms, 1 s, 2 s, 4 and 8 s.
3. in the loop routine you add:
to reset the watch-dog timer within the watch-dog timeout.
see also: http://tushev.org/articles/electronics/48-arduino-and-watchdog-timer for more information.