-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
55 lines (48 loc) · 1.38 KB
/
app.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
49
50
51
52
53
54
55
//http://swupdate.openvpn.org/as/openvpn-as-2.0.20-Ubuntu14.amd_64.deb
//ODpe73AFDHbykFT9jhI2Q04kKGjYnOJu7w3yC9BzSxiYkLyKkHQEhydIXkCXLIFc3FaR9nZI
var midiport = 0;
var midiConnector = require('midi-launchpad').connect(midiport);
// wait for the connector to be ready
midiConnector.on("ready",function(launchpad) {
console.log("Launchpad ready, let's do something");
var green = launchpad.colors.green.high;
var off = launchpad.colors.off;
//launchpad.scrollString('hello', colour);
//launchpad.displayString('EMF', colour);
launchpad.on("press", function(btn) {
console.log("Pressed: "+
"x:" +btn.x +", "+
"y:" +btn.y +", "+
"state:" +btn.getState() +", "+
"special:" +btn.special
);
if(!(btn.x == 8 && btn.y == 7)){
if(btn.getState() == 0) {
btn.light(green);
}
else {
btn.light(off);
}
}
});
var clearButton = launchpad.getButton(8, 7);
clearButton.on('press', function(){
launchpad.clear();
clearButton.light(launchpad.colors.red.high);
});
clearButton.light(launchpad.colors.red.high);
// launchpad.clear();
// launchpad.renderBytes(
// [
// " gg gg ",
// "g g g g",
// "ggg ggg",
// " g ",
// " g ",
// "g gg g",
// " g g ",
// " gggg ",
// //"rrr rrr",
// ]
// );
});