void oscEvent(OscMessage theOscMessage) { // This runs whenever there is a new OSC message

String addr = theOscMessage.addrPattern(); // Creates a string out of the OSC message if(addr.indexOf("/1/toggle") !=-1){ // Filters out any toggle buttons int i = int((addr.charAt(9) )) - 0x30; // returns the ASCII number so convert into a real number by subtracting 0x30 led[i] = int(theOscMessage.get(0).floatValue()); // Puts button value into led[i] // Button values can be read by using led[0], led[1], led[2], etc.

} }

void draw() { background(50); // Sets the background to a dark grey, can be 0-255

if(led[1] == 0){ // If led button 1 if off do.... arduinoPort.write("a"); // Sends the character “r” to Arduino redLED = 0; // Sets redLED color to 0, can be 0-255 } if(led[1] == 1){ // If led button 1 is ON do... arduinoPort.write("A"); // Send the character “R” to Arduino redLED = 255; // Sets redLED color to 255, can be 0-255 } fill(redLED,0,0); // Fill rectangle with redLED amount ellipse(50, 50, 50, 50); // Created an ellipse at 50 pixels from the left... // 50 pixels from the top and a width of 50 and height of 50 pixels }

According to the output capted by the touchosc (0 or 1), Processing will write on the Arduino serial port 2 values: a, A. So, in Arduino you need a script to capture those two values and convert in functions like LedOn/LedOff, etc. here is the code you have to send into Arduino.