只有三個函式,
MsTimer2::set(unsigned long ms, void (*f)()) ,設定定時及呼叫的語句
MsTimer2::start() ,定時開始
MsTimer2::stop() ,定時停止
reference的library中有解釋和例子(每500ms亮燈)
#include
void flash() {
static boolean output = HIGH;
digitalWrite(13, output);
output = !output;
}
void setup() {
pinMode(13, OUTPUT);
MsTimer2::set(500, flash); // 500ms period
MsTimer2::start();
void loop() {
只有三個函式,
MsTimer2::set(unsigned long ms, void (*f)()) ,設定定時及呼叫的語句
MsTimer2::start() ,定時開始
MsTimer2::stop() ,定時停止
reference的library中有解釋和例子(每500ms亮燈)
#include
void flash() {
static boolean output = HIGH;
digitalWrite(13, output);
output = !output;
}
void setup() {
pinMode(13, OUTPUT);
MsTimer2::set(500, flash); // 500ms period
MsTimer2::start();
}
void loop() {
}