For my Physical Computing final I used Processing to capture and parse sensor data from the tilt switch in the felt ball interface I sewed. The Xbees sent data into Processing, which were parsed by counting through the data and picking out the relevant sensor information. Then, I used the MaxLink library to send the data to Max 6.
import com.cycling74.io.*;
import com.cycling74.net.*;
import com.cycling74.util.*;
import maxlink.*;
import com.cycling74.msp.*;
import com.cycling74.max.*;
import com.cycling74.mxjedit.*;
int counter = 0;
import processing.serial.*;
//constructor, references parent object, and Max sketch
MaxLink link = new MaxLink(this, “RecordDemo_D6″);
Serial myPort;
void setup() {
size(50, 50);
// println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
}
void serialEvent(Serial myPort) {
int inByte = myPort.read();
if (inByte == 0x7E) {
counter = 0;
println();
}
else {
counter++ ;
}
if (counter == 16) {
println(“THE CRAZY NUMBER IS:” + inByte);
link.output(inByte);
}
print(inByte);
print(” ” );
}
Then, I learned Max and wrote this patch (with the help of Nick Johnson and Michael Rosen) which takes-in and reacts to the sensor data sent from Processing. This runs the the Max patch, which is a game of Mad Libs played out loud. It prompts you, with a pre-recorded cue to record a part of speech and integrates your response into a pre-recorded story.








