forked from rawcreative/node-e131
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
27 lines (22 loc) · 760 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
26
27
var ctrl = require('./ctrl.js');
var controller = new ctrl.Controller("10.10.10.12", 25, 512);
var blue = {red:0, green:0, blue:255};
var green = {red:0, green:255, blue:0};
var red = {red:255, green:0, blue:0};
var white = {red:255, green:255, blue:255};
var pixel = new ctrl.Pixel(controller, 1);
var pixel2 = new ctrl.Pixel(controller, 4);
var pixel3 = new ctrl.Pixel(controller, 7);
var colors = [blue, green, red, white];
var len = colors.length;
var cyclewait = 500;
var counter = 0;
var cycleColors = function(){
pixel.setVals(colors[counter%len]);
pixel2.setVals(colors[(counter+1)%len]);
pixel3.setVals(colors[(counter+2)%len]);
controller.send();
counter++;
setTimeout(cycleColors, cyclewait);
};
cycleColors();