我正在尝试使用看门狗中断作为计时器,让我的 Arduino 休眠一段时间。我的问题在于,在唤醒时,我需要执行超过 8 秒的操作。
目前,我的 Arduino 将休眠 1 分钟,使用看门狗的连续中断将其唤醒并使其重新进入休眠状态。然而,1 分钟后,我开始执行超过 8 秒的操作,并且看门狗中断超时。
我想关闭看门狗定时器,进行操作,然后重新启用它并返回睡眠状态。
这是我的代码:
#include "Adafruit_FONA.h"
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
#define FONA_RX 10
#define FONA_TX 9
#define FONA_RST 4
#define LED_PIN 8
// this is a large buffer for replies
char replybuffer[255];
char *SMSnumber = "6015962842";
char stack[128] = {'c'};
//Value for watchdog timer interrupt.
volatile int f_wdt = 1;
int seconds = 0;
int minutes = 1;
int hours = 0;
int interval = ((hours*60*60) + …Run Code Online (Sandbox Code Playgroud)