Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. void setup()
  2. {
  3.   Serial.begin(9600);
  4.   Serial.println("Initialising...");
  5.   delay(100); //Allow for serial print to complete.
  6.  
  7.   pinMode(LED_PIN,OUTPUT);
  8.  
  9.   /*** Setup the WDT ***/
  10.  
  11.   /* Clear the reset flag. */
  12.   MCUSR &= ~(1<<WDRF);
  13.  
  14.   /* In order to change WDE or the prescaler, we need to
  15.    * set WDCE (This will allow updates for 4 clock cycles).
  16.    */
  17.   WDTCSR |= (1<<WDCE) | (1<<WDE);
  18.  
  19.   /* set new watchdog timeout prescaler value */
  20.   WDTCSR = 1<<WDP0 | 1<<WDP3; /* 8.0 seconds */
  21.  
  22.   /* Enable the WD interrupt (note no reset). */
  23.   WDTCSR |= _BV(WDIE);
  24.  
  25.   Serial.println("Initialisation complete.");
  26.   delay(100); //Allow for serial print to complete.
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement