本文整理汇总了C++中Ticker::attach_ms方法的典型用法代码示例。如果您正苦于以下问题:C++ Ticker::attach_ms方法的具体用法?C++ Ticker::attach_ms怎么用?C++ Ticker::attach_ms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticker
的用法示例。
在下文中一共展示了Ticker::attach_ms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kickExternalWatchdog
void kickExternalWatchdog(void) {
static bool locked = false;
static bool wdog_state = false;
static bool wdog_configured = false;
if (!wdog_configured) {
pinMode(WATCHDOG_WOUT_PIN, OUTPUT);
kickAllSoftwareWatchdogs();
SWWatchdog.attach_ms(300, softwareWatchdog); // Check for stuck tasks and kick external Watchdog
// The external wdog trips after 1.6s, but the timing is sloppy for the ESP8266, need this as 300ms.
wdog_configured = true;
startedTime = millis();
Serial.println(F("Software watchdog initialized."));
}
if (!locked) {
locked = true;
pinMode(WATCHDOG_WOUT_PIN, OUTPUT);
if (wdog_state) {
digitalWrite(WATCHDOG_WOUT_PIN, HIGH);
wdog_state = false;
}
else {
digitalWrite(WATCHDOG_WOUT_PIN, LOW);
wdog_state = true;
}
locked = false;
}
}