ArduinoにWatch Dog Timer

Arduinoで遊ぼう - ウォッチドッグタイマを使うより
1
2
3
4
5
6
7
8
9
10
#include <avr/wdt.h>
 
void setup(){
  wdt_enable(WDTO_2S);
}
 
void loop(){
  do_something();
  wdt_reset();
}

特にライブラリの追加もなく動いた。組み込み機器の開発やってると、Watch Dog Timerはどうしても入れたくなる。自作のモニターに追加した。

コメント

このブログの人気の投稿

Python OpenCVとWebカメラでバーコードリーダー

VB.net Dictionaryクラスの初期化