-
Notifications
You must be signed in to change notification settings - Fork 0
/
jivepi.js
48 lines (41 loc) · 1.08 KB
/
jivepi.js
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
var lib = require('./jivelib');
var ledManager = require('./ledManager');
function main() {
try {
lib.getLastActivity().then(function (type) {
switch (type) {
case 'COMMENT' :
case 'REPLY':
ledManager.turnOn(0, 1, 0);
break;
case 'ACCOUNT':
ledManager.turnOn(1, 1, 0);
break;
case 'LIKE':
ledManager.turnOn(1, 0, 0);
break;
case 'JOIN':
ledManager.turnOn(1, 0, 1);
break;
case 'CREATE':
ledManager.turnOn(0, 0, 1);
break;
case 'UNKNOWN':
console.log('UNKNOWN type');
break;
}
});
} catch (error) {
console.log(error);
}
setTimeout(main, 10000);
};
//add in your script launcher gpio-admin unexport <port> if you need to relaunch
ledManager.setup().then(
function () {
main();
},
function (error) {
console.log(error);
}
);