setPeriod()
説明
ウォッチドッグタイマーの時間サイクルの設定。
プログラミング言語
TimerWDT.setPeriod(time)
パラメータ
time:時間サイクル、単位は µs。
フィードバック
なし
例
ウォッチドッグタイマーを中断モードを設定をし、200ms ごとに LED を点滅させる:
#include <TimerWDT.h>
void setup()
{
pinMode(13, OUTPUT);
TimerWDT.initialize();
TimerWDT.setPeriod(200000); // 時間サイクル 200ms を設定する。
TimerWDT.attachInterrupt( timerIsr ); // ユーサー ISR をマウントして、200ms ごとに実行する
}
void loop() {}
// ユーサー ISR
void timerIsr()
{
// LED を点滅させる
digitalWrite( 13, digitalRead( 13 ) ^ 1 );
}
See also
- initialize()
- attachInterrupt()
- detachInterrupt()
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.
