Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/wdt.h>
- #define led 13 // pin 13 is connected to a led on Arduino Uno
- //---------------------------------------
- void setup()
- {
- Serial.begin(115200);
- pinMode(led, OUTPUT); // set pin mode
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(1000); // wait for a tenth of a second
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a tenth of a second
- wdt_enable(WDTO_4S); // enable the watchdog 4 segundos
- Serial.println("WDT");
- }
- //---------------------------------------
- void loop()
- {
- //wdt_reset(); // uncomment to avoid reboot
- digitalWrite(led, !digitalRead(led)); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a tenth of a second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement