|
#include <MsTimer2.h> //定時(shí)器庫(kù)的 頭文件
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è)置函數(shù),每 500ms 進(jìn)入一次中斷
MsTimer2::start(); //開始計(jì)時(shí)
}
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);
}
|
評(píng)分
-
查看全部評(píng)分
|