I set a few potentiometer’s to test using input with Processing and a video. I also set up Processing to work with an external monitor that I got.
I still haven’t settled on the aesthetic for the facade, but I did some sketches and pulled some images I like. I want to take a trip to Built It Green this weekend and look at that stuff.
Pages: 1 2
My Processing code:
import processing.video.*;
import processing.serial.*;
import processing.opengl.*;
Movie myMovie;
Serial port;
float framePos = 0;
float videoX = 0;
float videoY = 0;
void setup() {
size(800, 480, OPENGL);
frame.setLocation(0, 0);
frameRate(30);
myMovie = new Movie(this, "bsu1.mov");
myMovie.loop();
println(Serial.list());
String portName = Serial.list()[0];
port = new Serial(this, portName, 9600);
port.bufferUntil('\n');
}
void draw() {
background(0);
if (myMovie.available()) {
myMovie.read();
}
image(myMovie, -videoX, -videoY);
myMovie.jump(framePos);
}
void mousePressed() {
println(myMovie.time());
}
public void init() {
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
super.init();
}
void serialEvent (Serial myPort) {
String myString = myPort.readStringUntil('\n');
if (myString != null) {
//x`println(myString);
}
myString = trim(myString);
int sensors[] = int(split(myString, ','));
for (int i = 0; i < sensors.length; i++) {
print("Sensor" + i + ": " + sensors[i] + "\t");
}
println();
if (sensors.length > 2) { // wait for all sensors
framePos = map(sensors[0], 0, 1023, 0, myMovie.duration());
videoX = map(sensors[1], 0, 1023, 0, myMovie.width - width);
videoY = map (sensors[2], 0, 1023, 0, myMovie.height - height);
}
}



