#include <MsTimer2.h> //定時器庫的 頭文件
int LED1=13;
int LED2=9;
void setup() {
// put your setup code here, to run once:
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
MsTimer2::set(500, dongzuo); // 中斷設置函數(shù),每 500ms 進入一次中斷
MsTimer2::start(); //開始計時
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED1,HIGH);
delay(1000);
digitalWrite(LED1,LOW);
delay(1000);
}
void dongzuo()
{
/*
static boolean out=HIGH;
digitalWrite(LED2,out);
out=!out;
*/
digitalWrite(LED2,HIGH);
delay(100);
digitalWrite(LED2,LOW);
delay(100);
}
|