How to interrupt watchdog?

Hi,
I'm trying to make a low-consumption circuit and I would very much like to use watchdog. It works great, but I'd like to be able to wake up the "system" to change values etc. I tryed with interrupts, but they don't work when arduino sleeps. Any idea?

Regards,
Peter

I don't think you're actually able to "interrupt" the watchdog, as it powers down almost every aspect of the chip.

One thing you could do is run an if statement at the beginning of the loop, like (might be easier to use a switch, rather than push button for this.. but it's just an example)

if(buttonRead(8) == HIGH){ debug(); }
// watchdogtimer

Debug being the function you want to run to change values, or you could even have it set up a while loop..

if(buttonRead(8) == HIGH){ DEBUG = 1;}
while(DEBUG == 1){
//read sensors, change values, etc, etc
DEBUG = 0;
}
//watchdogtimer

I'm not sure how the watchdog timer works exactly.. so I might be missing some important details, but these should get you in the right direction!:smiley:

Well, I made it like that: while I am in the menu (I use LCD and 4 buttons) I don't go to sleep and when I exit menu, I just added
if(menu==0){ system_sleep(); }

The problem is, if I want to efectively run watchdog I should put it to sleep to maximum time (8 seconds) and to hold a button for at most 8sec is kinda...not nice, if you understand what I mean. The same with your code, you have to wait for watchdog timeout.