Also mit faden müsste das doch eigentlich so aussehen oder nciht ?!
// import oscP5 libraries and Arduino serial libraries
import oscP5.*;
import netP5.*;
import processing.serial.*;
import cc.arduino.*;
// make a new Arduino object
Arduino arduino;
// make a new oscP5 object
OscP5 oscP5;
// setup the value for the button
float v_fader2 = 0.0f;
// run the setup loop
void setup() {
// configure the screen size and frame rate
size(200,200);
frameRate(30);
// start oscP5, listening for incoming messages at port 8000
// if your outgoing port on TouchOSC is not 8000, edit it here
oscP5 = new OscP5(this,8000);
// establish a serial connection with the Arduino at 57600 baud
// this will use the first listing in the serial list, change if necessary
arduino = new Arduino(this,Serial.list()[0],57600);
// setup Arduino pin 13 as output
arduino.pinMode(13, Arduino.OUTPUT);
}
// when OSC packets are received
void oscEvent(OscMessage theOscMessage) {
// set the current address to the control name
String addr = theOscMessage.addrPattern();
// get the value of the control
float val = theOscMessage.get(0).floatValue();
// if the control toggled is toggle1, then toggle float value
if(addr.equals("/1/fader2")) { v_fader2 = val; }
}
// the program loop
void draw() {
// if toggle = off, then make black background
// if toggle = on, then make orange background
if ((int) v_fader2 == 0){
background(0);
} else {
background(255, 165, 0);
}
// write the int value of toggle button to pin 13 on Arduino
arduino.digitalWrite(13, (int) v_fader2);
// print the status in serial debugger
println(v_fader2);
}