I'm trying to add a watchdog on an Arduino Nano, for my code, and I'm following exactlythe code in this manual exactly, but after the amount of time for not resetting the watchdog-, it resets but does not reboot.
AtIn the last paragraph- it says that :"
However, I could not find something similar in Optiboot bootloader (If I'm wrong, correct me please!), used by Arduino UNO and other new boards. It seems that they sacrificed this check for size. So, it is possible that watchdog timer will be enabled after reset, so - if you set it's value too low, your board may never come out of bootloader stage. So, to be always on the safe side, set watchdog to longer periods (2S and more).
So I've tried for 8s8 s, but still same result.
What is wrong ?
EDIT1:
#include <avr/wdt.h>
int k=1;
void setup() {
Serial.begin(9600);
wdt_enable(WDTO_8S);
}
void loop() {
//do stuff here
k++;
wdt_reset();
Serial.println(1000 * k);
delay(1000 * k);
}