-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLEDS.h
More file actions
114 lines (84 loc) · 2.03 KB
/
LEDS.h
File metadata and controls
114 lines (84 loc) · 2.03 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#define LedBlue 23 //active high output
#define LedGreen 22 //active high output
#define LedCharge 34 //active low output Red Led: Low input shows charging
#define ON true
#define On true
#define on true
#define Off false
#define OFF false
#define off false
unsigned long previous_millis = 0;
unsigned int interval = 3000;
//////
///
///
void blueLed(bool status){
if(status){
digitalWrite(LedBlue, HIGH);
}
else{
digitalWrite(LedBlue, LOW);
}
}
void greenLed(bool status){
if(status){
digitalWrite(LedGreen, HIGH);
}
else{
digitalWrite(LedGreen, LOW);
}
}
void redLed(bool status){
if(status){
digitalWrite(LedCharge, LOW);
}
else{
digitalWrite(LedCharge, HIGH);
}
}
void randomLed(){
analogWrite(LedBlue, random(128));
analogWrite(LedGreen, random(200));
//analogWrite(LedCharge, random(64));
}
int ledStatex = LOW;
unsigned long previousMillisx = 0;
const long intervalx = 500;
void flashBlue() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillisx >= interval) {
previousMillisx = currentMillis;
if (ledStatex == LOW) {
ledStatex = HIGH;
} else {
ledStatex = LOW;
}
digitalWrite(LedBlue, ledStatex);
}
}
void initPins(){
pinMode(KeyLatchPin, OUTPUT);
digitalWrite(KeyLatchPin, HIGH);
pinMode(LedBlue, OUTPUT);
digitalWrite(LedBlue, LOW);
pinMode(LedGreen, OUTPUT);
digitalWrite(LedGreen, LOW);
///
pinMode(PowerBtnPin, INPUT_PULLDOWN);
pinMode(LeftBtnPin, INPUT_PULLUP);
pinMode(RightBtnPin, INPUT_PULLUP);
pinMode(PairBtnPin, INPUT_PULLUP);
}
void ledSeq(){
PRINTLINE("Power On Sequence 1");
powerOnline();
PRINTLINE("Sucess On Sequence 1");
blueLed(on);
PRINTLINE("Blue LED On 1");
PRINTLINE("Power On Sequence 1");
initButtons();
PRINTLINE("Output Pins Initialized");
powerOnline();
PRINTLINE("Assert Power On Sequence 2");
PRINTLINE("\nSerial Port Enabled:");
}