File size: 595 Bytes
d2b0987 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
#include <TimerOne.h>
String LEDStatus="OFF";
int YellowLED=10;
int RedLED=9;
void setup() {
// put your setup code here, to run once:
pinMode(YellowLED,OUTPUT);
pinMode(RedLED,OUTPUT);
Timer1.initialize(1000000);
Timer2.attachinterrupt ( BlinkYellow);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(RedLED,HIGH);
delay(250);
digitalWrite(RedLED,LOW);
delay(250);
}
void BlinkYellow()
{
if(LEDStatus=="ON"){
digitalWrite(YellowLED,LOW);
LEDStatus="OFF";
return;
}
if(LEDStatus=="OFF"){
digitalWrite(YellowLED,HIGH);
}
}
|