-
Notifications
You must be signed in to change notification settings - Fork 23
/
test.js
25 lines (19 loc) · 798 Bytes
/
test.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
var artnet = require('./lib/artnet.js')();
var c = 0;
setInterval(function () {
if (++c > 255) c = 0;
console.log('sending ' + c + ' to all channels in all universes');
for (var i = 0; i < 8; i++) {
(function (_i, _c) {
artnet.set(_i, 1, Array.apply(null, new Array(512)).map(function () { return _c; }, 0), function (err, res) {
if (err) {
console.error('error sending to universe ' + i, err);
} else if (res === 530) {
console.log('sent ' + _c + ' to all channels in universe ' + _i);
} else {
console.error('error sending to universe ' + _i + ': only ' + res + ' bytes where sent');
}
});
})(i, c);
}
}, 40);