Created
March 12, 2018 00:30
-
-
Save desireesantos/e22d09dc91140acd4b901050b8d507a7 to your computer and use it in GitHub Desktop.
WatchDog solution to reset arduino every 4 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <avr/wdt.h> | |
void setup() { | |
//Reset arduino every 4 seconds WDTO_4S | |
//https://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html#ga9e52c54d10b6a6a7ce04aaaa4abea51f | |
wdt_enable(WDTO_4S); | |
Serial.begin(9600); | |
} | |
void loop() { | |
// wdt_reset(); If you want to reset the timer to zero, just call this function | |
for(int i=0; i<=1000; i++){ | |
Serial.println(i); | |
delay(50); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment