Also here is the code I was using in Processing 2:
import fullscreen.*;
import processing.serial.*;
Serial myPort;
FullScreen fs;
float accelX, accelY, accelZ;
///
import processing.video.*;
Movie movie;
void setup() {
size(640,480);
movie = new Movie(this, "cat.mov");
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
// don't generate a serialEvent() unless you get a newline character:
myPort.bufferUntil('\n');
noCursor();
// Create the fullscreen object
fs = new FullScreen(this);
// enter fullscreen mode
fs.enter();
///
}
void draw() {
// Ratio of mouse X over width
float ratio = accelX / (float) width;
// The jump() function allows you to jump immediately to a point of time within the video.
// duration() returns the total length of the movie in seconds.
movie.jump(ratio*movie.duration());
// Read frame
movie.read();
// Display frame
image(movie,0,0);
}
void serialEvent (Serial myPort) {
// get the ASCII string:
String inString = myPort.readStringUntil('\n');
if (inString != null) {
// trim off any whitespace:
inString = trim(inString);
// split the string on the commas and convert the
// resulting substrings into an integer array:
float[] accel = float(split(inString, ","));
// if the array has at least three elements, you know
// you got the whole thing. Put the numbers in the
// color variables:
if (accel.length >=3) {
accelX = map(accel[0], 0, 1023, 0, height);
accelY = map(accel[1], 10, 52, 0, width);
//accelZ = map(accel[2], 0, 255, 0, 255);
//line(width/2, height/2, accelX, accelY);
}
}
}