-
Notifications
You must be signed in to change notification settings - Fork 1
/
dmx.pde
65 lines (50 loc) · 1.58 KB
/
dmx.pde
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
import dmxP512.*;
import processing.serial.*;
DmxP512 dmxOutput;
int universeSize=128;
boolean LANBOX=false;
String LANBOX_IP="192.168.1.77";
boolean DMXPRO=true;
String DMXPRO_PORT = "/dev/tty.usbserial-6AWY0JLI";//case matters ! on windows port must be upper cased.
//String DMXPRO_PORT="/dev/ttyUSB0";//case matters ! on windows port must be upper cased.
int DMXPRO_BAUDRATE=115000;
void setupDMX() {
dmxOutput=new DmxP512(this, universeSize, false);
if (LANBOX) {
dmxOutput.setupLanbox(LANBOX_IP);
}
if (DMXPRO) {
dmxOutput.setupDmxPro(DMXPRO_PORT, DMXPRO_BAUDRATE);
}
/*wrgb
for (int d=1; d<200; d+=4){
dmxOutput.set(d,255);
}
*/
dmxPos = new int[dmxAddr*dmxUniv];
//starting dmx address, dmx universe, xpos, ypos
// dmxPos[1] = xyPixels(10, 10, canvasW);
dmxPos[xyPixels(1, 1, dmxUniv)] = xyPixels(10, 10, canvasW);
dmxPos[xyPixels(4, 1, dmxUniv)] = xyPixels(10, 50, canvasW);
dmxPos[xyPixels(7, 1, dmxUniv)] = xyPixels(10, 90, canvasW);
}
void drawDMX() {
loadPixels();
// colorMode(HSB, 255);
for (int y = 1; y < dmxAddr+1; y+=3) {
for (int x = 1; x < dmxUniv+1; x++) {
thisDmxPos = ledPos[xyPixels(x, y, dmxUniv)];
color c = pixels[thisDmxPos];
dmxOutput.set(y, (int)red(c));
dmxOutput.set(y+1, (int)green(c));
dmxOutput.set(y+2, (int)blue(c));
}
}
/*
color c = pixels[1];
Pixel p = new Pixel((byte)red(c), (byte)green(c), (byte)blue(c));
dmxOutput.set(0+1, (int)red(c));
dmxOutput.set(0+2, (int)green(c));
dmxOutput.set(0+3, (int)blue(c));
*/
}