No I don't sorry, rather new to this. The library was from here - http://gsvideo.sourceforge.net/ it was suggested so that I could see the footage of the video. Thanks for you help, it is now connected to the arduino port. Now I just need to figure out how to make the video only play when someone walks past the IR Sensor instead of just on a loop. I really do appreciate your help!
As I said before change this:-
if(xpos > 190){
image(movie,0,0,width, height);
}else background(0);
to:-
if(xpos > 190){
image(movie,0,0,width, height);
xpos = 0;
}else background(0);
Thanks, I changed your code but it still didn't work. I managed to catch up with the person who first helped me with the code and he came up with this code which now works as a pushbutton so on wednesday we hope to figure out how to do it as an IR Sensor.
//Processing sketch to run with this example:
// This example code is in the public domain.
import codeanticode.gsvideo.*;
GSMovie movie;
import processing.serial.*;
int bgcolor; // Background color
int fgcolor; // Fill color
Serial myPort; // The serial port
int[] serialInArray = new int[3]; // Where we'll put what we receive
int serialCount = 0; // A count of how many bytes we receive
int xpos, ypos = 0; // Starting position of the ball
boolean firstContact = false; // Whether we've heard from the microcontroller
long movLength = 0;
void setup() {
size(640, 480); // Stage size
noStroke(); // No border on the next thing drawn
movie = new GSMovie(this, "MajorProjectVid.mov");
// Set the starting position of the ball (middle of the stage)
xpos = width/2;
ypos = height/2;
// Print a list of the serial ports, for debugging purposes:
println(Serial.list());
// I know that the first port in the serial list on my mac
// is always my FTDI adaptor, so I open Serial.list()[0].
// On Windows machines, this generally opens COM1.
// Open whatever port is the one you're using.
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 9600);
}
void movieEvent(GSMovie movie) {
movie.read();
}
void draw() {
movLength = movie.frame(); // 1758 total frames
println(movLength);
if (fgcolor > 120) {
movie.play();
}
else {
background(0);
}
image(movie, 0, 0, width, height);
if (movie.frame() == 1757.0) {
movie.goToBeginning();
movie.pause();
}
}
void serialEvent(Serial myPort) {
// read a byte from the serial port:
int inByte = myPort.read();
// if this is the first byte received, and it's an A,
// clear the serial buffer and note that you've
// had first contact from the microcontroller.
// Otherwise, add the incoming byte to the array:
if (firstContact == false) {
if (inByte == 'A') {
myPort.clear(); // clear the serial port buffer
firstContact = true; // you've had first contact from the microcontroller
myPort.write('A'); // ask for more
}
}
else {
// Add the latest byte from the serial port to array:
serialInArray[serialCount] = inByte;
serialCount++;
// If we have 3 bytes:
if (serialCount > 2 ) {
xpos = serialInArray[0];
ypos = serialInArray[1];
fgcolor = serialInArray[2];
// print the values (for debugging purposes only):
// println(xpos + "\t" + ypos + "\t" + fgcolor);
// Send a capital A to request new sensor readings:
myPort.write('A');
// Reset serialCount:
serialCount = 0;
}
}
}