Advertisement
RuiViana

TestaWDT.ino

Nov 9th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <avr/wdt.h>
  2. #define led 13 // pin 13 is connected to a led on Arduino Uno
  3. //---------------------------------------
  4. void setup()
  5. {
  6.   Serial.begin(115200);
  7.   pinMode(led, OUTPUT);       // set pin mode
  8.   digitalWrite(led, HIGH);    // turn the LED on (HIGH is the voltage level)
  9.   delay(1000);                // wait for a tenth of a second
  10.   digitalWrite(led, LOW);     // turn the LED off by making the voltage LOW
  11.   delay(1000);                // wait for a tenth of a second
  12.   wdt_enable(WDTO_4S);        // enable the watchdog 4 segundos
  13.    Serial.println("WDT");
  14. }
  15. //---------------------------------------
  16. void loop()
  17. {
  18.   //wdt_reset();                          // uncomment to avoid reboot
  19.   digitalWrite(led, !digitalRead(led));   // turn the LED off by making the voltage LOW
  20.   delay(1000);                            // wait for a tenth of a second
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement