-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.js
71 lines (67 loc) · 1.82 KB
/
test2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// red segment bouncing
var lightctrl = require('./lightctrl.js');
var modes = lightctrl.modes;
var client = new lightctrl.DmxClient("10.1.20.164");
var c3_red_l = {
red_l : 255,
green_l : 0,
blue_l : 0,
red_m : 0,
green_m : 0,
blue_m : 0,
red_r : 0,
green_r : 0,
blue_r : 0};
var c3_red_m = {
red_l : 0,
green_l : 0,
blue_l : 0,
red_m : 255,
green_m : 0,
blue_m : 0,
red_r : 0,
green_r : 0,
blue_r : 0};
var c3_red_r = {
red_l : 0,
green_l : 0,
blue_l : 0,
red_m : 0,
green_m : 0,
blue_m : 0,
red_r : 255,
green_r : 0,
blue_r : 0};
var c3_black = {
red_l : 0,
green_l : 0,
blue_l : 0,
red_m : 0,
green_m : 0,
blue_m : 0,
red_r : 0,
green_r : 0,
blue_r : 0};
var left = new lightctrl.Device(client, 78, modes['3_segment']);
var middle = new lightctrl.Device(client, 67, modes['3_segment']);
var right = new lightctrl.Device(client, 56, modes['3_segment']);
var colors = [c3_red_l, c3_red_m, c3_red_r];
var lights = [left, middle, right];
var frames = [ [left, c3_red_l], [left, c3_red_m], [left, c3_red_r],
[middle, c3_red_l], [middle, c3_red_m], [middle, c3_red_r],
[right, c3_red_l], [right, c3_red_m], [right, c3_red_r],
[right, c3_red_m], [right, c3_red_l],
[middle, c3_red_r], [middle, c3_red_m], [middle, c3_red_l],
[left, c3_red_r], [left, c3_red_m]
];
var len = frames.length;
var cyclewait = 250;
var pos = 0;
var cycleColors = function(){
frames[pos%len][0].setVals(c3_black);
pos++;
frames[pos%len][0].setVals(frames[pos%len][1]);
client.channelsCommit();
setTimeout(cycleColors, cyclewait);
};
cycleColors();