Recently I got an Arduino project to prove my worth as a micro-controller laboratory assistant.
However, at the time, when I was trying to use the sensor, suddenly my Arduino became
unresponsive because the sensor was producing a negative output.
Then, the urgency of self-restart made me search for a solution. Luckily, someone had already done it using wdt.h library.
To use the function, you need include wdt.h library like this.
#include <avr/wdt.h>
We will use two functions: wdt_disable and wdt_enable, as you can see below
void
myreset(void) {
Serial.println("Aku nak restart");
wdt_disable();
wdt_enable(WDTO_15MS);
while(1) {}
}
Leave a Reply