antitheft159
commited on
Commit
•
d2b0987
1
Parent(s):
f17d8f6
Upload elkhart.195.ino
Browse files- elkhart.195.ino +31 -0
elkhart.195.ino
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#include <TimerOne.h>
|
2 |
+
String LEDStatus="OFF";
|
3 |
+
int YellowLED=10;
|
4 |
+
int RedLED=9;
|
5 |
+
|
6 |
+
void setup() {
|
7 |
+
// put your setup code here, to run once:
|
8 |
+
pinMode(YellowLED,OUTPUT);
|
9 |
+
pinMode(RedLED,OUTPUT);
|
10 |
+
Timer1.initialize(1000000);
|
11 |
+
Timer2.attachinterrupt ( BlinkYellow);
|
12 |
+
}
|
13 |
+
|
14 |
+
void loop() {
|
15 |
+
// put your main code here, to run repeatedly:
|
16 |
+
digitalWrite(RedLED,HIGH);
|
17 |
+
delay(250);
|
18 |
+
digitalWrite(RedLED,LOW);
|
19 |
+
delay(250);
|
20 |
+
}
|
21 |
+
void BlinkYellow()
|
22 |
+
{
|
23 |
+
if(LEDStatus=="ON"){
|
24 |
+
digitalWrite(YellowLED,LOW);
|
25 |
+
LEDStatus="OFF";
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
if(LEDStatus=="OFF"){
|
29 |
+
digitalWrite(YellowLED,HIGH);
|
30 |
+
}
|
31 |
+
}
|