-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatusLed.h
49 lines (44 loc) · 1.06 KB
/
statusLed.h
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
/* Weatherstation
builtin LED as status
Author: Christian Langrock
Date: 2022-August-07
*/
int countLED {0};
void initStatusLed() {
pinMode(LED_BUILTIN_1, OUTPUT);
//LED on
ESP8266status = 0;
}
void StatusLed(int ESPstatus) {
switch (ESPstatus) {
case 0:
//LED on
digitalWrite(LED_BUILTIN_1, LOW);
break;
case 1:
// normal run, slow blink
if ((digitalRead(LED_BUILTIN_1) == HIGH) && (countLED == 4)) {
digitalWrite(LED_BUILTIN_1, LOW);
countLED = 0;
}
else if ((digitalRead(LED_BUILTIN_1) == LOW) && (countLED == 4)) {
digitalWrite(LED_BUILTIN_1, HIGH);
countLED = 0;
}
break;
case 2:
// run with error, fast blink
if (digitalRead(LED_BUILTIN_1) == HIGH) {
digitalWrite(LED_BUILTIN_1, LOW);
countLED = 0;
}
else {
digitalWrite(LED_BUILTIN_1, HIGH);
}
break;
default:
digitalWrite(LED_BUILTIN_1, LOW);
break; // Wird nicht benötigt, wenn Statement(s) vorhanden sind
}
countLED++;
}