-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
49 lines (36 loc) · 760 Bytes
/
main.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
#include "application.h"
#include "InternetButton.h"
InternetButton b = InternetButton();
struct Rgb {
int r;
int g;
int b;
};
Rgb getColour(String notificationType);
int notification(String type);
void setup() {
Serial.begin(9600);
Particle.function("notify", notification);
b.begin();
}
void loop() {
}
int notification(String type) {
Rgb colour = getColour(type);
for(int i=0 ; i<8 ; i++) {
b.spin(colour.r, colour.g, colour.b, 100);
}
b.allLedsOff();
return 0;
}
Rgb getColour(String type) {
if(type == "PullRequest") {
// purple
return {255,0,255};
} else if(type == "Push") {
// green
return {0, 255, 0};
} else {
return {0,0,0};
}
}