...
Im Folgenden ein kleines Beispiel, welches einen RGB Wert an eine DMX Leuchte sendet
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import processing.serial.*; // Import the Processing Serial Library for communicating with arduino Serial dmxPort; // The used Serial Port int[][] dmxValues; //First dimension = number of DMX channels //Second dimension = channel, value int amountOfDMXChannels = 3; Serial port; void setup() { background(0); size(500, 500); println(Serial.list())frameRate(5); // Prints the list of serial available devices (Arduino should be on top of the list) println(Serial.list()); dmxPortport = new Serial(this, Serial.list()[Serial.list().length-1]"/dev/tty.usbmodem1411", 9600); // Open a new port and connect with Arduino at 9600 baud dmxValues = new int[amountOfDMXChannels][2]; dmxValues[0][0] = 0; dmxValues[1][0] = 1; dmxValues[2][0] = 2; } void draw() { background(0); color c = color(map(mouseX,0,width,0,255),map(mouseY,0,height,0,255),0sendDMX(1, 0); sendDMX(2, 0); sendDMX(1, 255); } void draw(){ while(port.available() > 0) { print(port.readString()); } int red = int(map(mouseX, 0, width, 0, 255)); int green = int(map(mouseY, 0, height, 0, 255)); background(red, green, 0); stroke(255); text("RRed: " + red(c) + "\t - GGreen: " +green(c)+"\t B: "+blue(c) green, 20, 20); dmxValues[0][1] = int(red(c) sendDMX(1, red); dmxValues[1][1] = int(green(c)); dmxValues[2][1] = int(blue(c)sendDMX(2, green); sendDMX(dmxValues3, 0); } void sendDMX(int valuesToSend[][]channel, int value) { for (int i=0; i<valuesToSend.length; i++) {print(str(channel)); print(":"); print(str(value)); print('\n'); dmxPortport.write(str(valuesToSend[i][0]channel)); dmxPortport.write(",:"); dmxPortport.write(str(valuesToSend[i][1]value)); dmxPortport.write("'\n"'); } } |
Einstellungen an den DMX Empfängern (Leuchten, Scanner usw.)
...