I want to reset Arduino (ATmega168) every 8 seconds.
To do this I want to use watchdog interrupt mode not system reset mode (I use system reset mode in the ISR(WDT_vect) function).
After 8 + 4 (wdt_enable(WDTO_4S)) seconds the LED (pin13) starts blinking very quick and reset button doeas not work. I need to cut the power off to restart my Arduino.
I want to reset Arduino (ATmega168) every 8 seconds.
Explain WHY first.
I need to reset the board when the app has locked up.
First I wanted to check if I can reset the board every 8 seconds... unfortunatelly it does not work.
I need to reset the board when the app has locked up.
In general, it is better to work on the other end of the problem. Why is the application locking up? It shouldn't unless it is running out of memory, waiting on hardware that is not responding, or some other addressable situation.
I have no idea why the code you have doesn't work. Does the interrupt handler get called?
One thing about setup() I notice is that << has a very low precedence. Some parentheses in the code in setup might be needed.
I need to reset the board when the app has locked up.
Would not it be better to try and find the root cause of your application code 'locking up"? Debugging code can be difficult but required in cases like this. Forcing a reset to work around a problem is not a solution but rather a poor hack in my opinion.
retrolefty:
Would not it be better to try and find the root cause of your application code 'locking up"? Debugging code can be difficult but required in cases like this. Forcing a reset to work around a problem is not a solution but rather a poor hack in my opinion.
once again... my goal is to reset the board (software-reset).
I want to know what I am doing wrong (this way we can lern something new!)
When I put 5v to pin 4 I expect that my board resets.
Unfortunatelly the PIN13 LED starts blinking and I have to cut the power off to restart my board (the reset button does not work).