I have this code that triggers the ISR at about 1 second and it works fine but inside the ISR I try to change the variable value to 99 but it never changes. The variable is declared as VOLATILE but even doing this it does not work.
gilperon: @aarg I know but for some reason any code I insert in the ISR(WDT_vect) { does not get executed, like lighitn the 13 pin LED. It never gets executed.
Here is a good page that covers using the Arduino WDT properly,
and also how to deal with the bootload lockup problem evident in some Arduino boards.
Seriously, both of your questions took 0.43 seconds to find answers to, according to Google. Please attempt to educate yourself before just wantonly asking for someone to fix your code.
gilperon:
Sorry Nick Gammon, but if you take a close look every question was a different one, but with the same "theme". I was not talking about exactly the same thing.
Yes, and in each of them you continue to ignore the advise given in the last one and you continue putting Serial.print statements in your ISR routines. You are wasting our time. This appears to be a habit with you. Start a thread, get good advise, ignore it, start a new thread. If you're not going to learn, then I'm done with any thread you start.
gilperon: @Delta_G thank you, I understood you wrong, sorry. I see you are right, but for some reason I am not getting the inteerrupt fired as you said. It only fires after one second of inactivity, it's not firing when I set it as you said. I turn on/off the pin 13 LED everytime the ISR is fired but it never fired when I set it, which is against what you said. Am I wrong?
No, you're not wrong. You're thick.
If the WDIF bit isn't set, then it won't fire. I didn't say clear it because it WILL fire. I didn't say anything WILL happen. I said clear it JUST IN CASE. It can't cause you any problem to clear it, but you cannot possibly see every possible scenario to know that it won't ever be sitting there waiting to get you.