#include
#define TIMEOUT WDTO_8S // predefine time, refer avr/wdt.h
const int ledPin = 13; // the number of the LED pin
void setup(){
// disable the watchdog
//wdt_disable();
pinMode(ledPin,OUTPUT);
// LED light once after start or if timeout
digitalWrite(ledPin,HIGH);
delay(1000);
// enable the watchdog
wdt_enable(TIMEOUT);
}
void loop(){
// process runing
digitalWrite(ledPin,LOW);
delay(9000); //if timeout trig the reset
//feed dog
wdt_reset();
}
Arduino UNO R3 + IDE Arduino-1.0.6 / 1.5.8 测试通过,仔细对比一下你就明白了!
发你一段看门狗例程!
#include
#define TIMEOUT WDTO_8S // predefine time, refer avr/wdt.h
const int ledPin = 13; // the number of the LED pin
void setup(){
// disable the watchdog
//wdt_disable();
pinMode(ledPin,OUTPUT);
// LED light once after start or if timeout
digitalWrite(ledPin,HIGH);
delay(1000);
// enable the watchdog
wdt_enable(TIMEOUT);
}
void loop(){
// process runing
digitalWrite(ledPin,LOW);
delay(9000); //if timeout trig the reset
//feed dog
wdt_reset();
}
Arduino UNO R3 + IDE Arduino-1.0.6 / 1.5.8 测试通过,仔细对比一下你就明白了!