-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLedStatusBar.cpp
62 lines (49 loc) · 885 Bytes
/
LedStatusBar.cpp
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
#include "Constants.h"
#include "Arduino.h"
#include "LedStatusBar.h"
void LedStatusBar::init(byte pin0, byte pin1, byte pin2)
{
_pin0 = pin0;
_pin1 = pin1;
_pin2 = pin2;
pinMode(pin0, OUTPUT);
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
}
void LedStatusBar::blink()
{
setStatus(0, 0, 0);
setStatus(1, 1, 1);
delay(BLINK_DELAY);
setStatus(0, 0, 0);
}
void LedStatusBar::shootAnimation()
{
blink();
delay(25);
blink();
delay(25);
blink();
}
void LedStatusBar::animate()
{
setStatus(0, 0, 0);
delay(150);
setStatus(0, 0, 1);
delay(150);
setStatus(0, 1, 0);
delay(150);
setStatus(1, 0, 0);
delay(150);
setStatus(0, 1, 0);
delay(150);
setStatus(0, 0, 1);
delay(150);
setStatus(0, 0, 0);
}
void LedStatusBar::setStatus(byte pin0, byte pin1, byte pin2)
{
digitalWrite(_pin0, pin0);
digitalWrite(_pin1, pin1);
digitalWrite(_pin2, pin2);
}