reset()
説明
ウォッチドッグタイマーをリセット (0 にさせる)。
この関数が主にウォッチドッグモードで使われ、CPU をウォッチドッグにリセットさせられないように、kicking the dog という動作を実行する。
プログラミング言語
TimerWDT.reset()
パラメータ
なし
フィードバック
なし
例
ウォッチドッグタイマーをウォッチドッグモードに設定し、30 秒でのシステムが自動的リセットをし、その上、アプリで 10 秒ごとウォッチドッグタイマーのリセットを設定する。
(一般の状況は上記の設定が発生しないので、もし外力により、システムがフリージングさせられたら、30 秒後ウォッチドッグタイマーがシステムをリセットさせる。)
#include <TimerWDT.h>
unsigned long currentTime;
void setup()
{
TimerWDT.initialize(30000000, true); // 30 秒時間サイクルを設定
currentTime = millis();
}
void loop() {
// リセットさせられないため、10 秒ごとに kicking the dog という動作を実行する
if((millis() - currentTime) > 10000)
{
TimerWDT.reset(); // ウォッチドッグタイマーをリセット
currentTime = millis();
}
// ユーサーアプリ ...
}
See also
- isResetByWDT()
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
