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?
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)
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.