-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe131.js
More file actions
23 lines (21 loc) · 823 Bytes
/
e131.js
File metadata and controls
23 lines (21 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
let e131 = require('e131');
// controling rgb matrix
let client = new e131.Client('192.168.223.6'); // or use a universe
let packet = client.createPacket(192); // we want 8 RGB (x3) slots
let slotsData = packet.getSlotsData();
packet.setSourceName('test E1.31 client');
packet.setUniverse(0x01); // make universe number consistent with the client
packet.setOption(packet.Options.PREVIEW, true); // don't really change any fixture
packet.setPriority(packet.DEFAULT_PRIORITY); // not strictly needed, done automatically
// slotsData is a Buffer view, you can use it directly
let color = 0;
function cycleColor() {
for (let idx=0; idx<slotsData.length; idx++) {
slotsData[idx] = color % 0xff;
color = color + 983;
}
client.send(packet, function () {
setTimeout(cycleColor, 125);
});
}
cycleColor();