I want to make a video play when someone walks past

Ok, I apologise I am really quite new to this and someone helped me set up the initial code (not entirely sure how they did it, I know they mixed Arduino and Processing). In order to do what your suggesting do I use an example from Arduino and one from Processing if so which one? Sorry again.

SerialCallResponse works on processing just trying to figure out arduino...

It looks like it is very old arduino code. This bit:-

    Serial.print(firstSensor, BYTE);
    Serial.print(secondSensor, BYTE);
    Serial.print(thirdSensor, BYTE);

should be

    Serial.write(byte(firstSensor));
    Serial.write(byte(secondSensor));
    Serial.write(byte(thirdSensor));

I changed that code thanks, still seems to just play on repeat. Don't know if this has something to do with it but when the numbers at the bottom are scrolling they don't start at 0 when my hand is away and go higher when I move my hand, it's constantly around 255

my hand is away and go higher when I move my hand

Are you are using code that you have not posted?

still seems to just play on repeat.

Sorry I don't know what that means.

Still using the same code sorry I meant when I move my hand closer to the IR Sensor, the numbers at the bottom of the code stay around 250, suggesting it can't tell if the code should be true or false as my guess (this might be the problem?). The video plays on repeat on a loop rather than only re-playing when my hand is near (as if the person were walking past)

The video plays on repeat on a loop rather than only re-playing when my hand is near

That is because:-

the numbers at the bottom of the code stay around 250,

As I said before you should check the arduino part of the code. Why are you sending three bytes when you only need one?
It looks like your sensor is not working like you think it should. Have you tested this with a sketch that just prints out the sensor value?
You have to get that bit working before trying to do the more complex thing of triggering a video.

Why are you sending three bytes when you only need one?

I think this is because in the processing example (Serial CallResponse) which is used in this code there are 3 (the IR Sensor has 3 wires - red, white and black maybe this is why you need three?).

Yesterday I used the Serial CallResponse using Processing version 1.5.1 and it worked. Today I tried the same example on Arduino and it worked (the numbers started around 30 and went up as my hand got closer). I then went back to the Processing Serial CallResponse and now it doesn't work (there is just a black screen when I click run).

I think this is because in the processing example (Serial CallResponse) which is used in this code there are 3 (the IR Sensor has 3 wires - red, white and black maybe this is why you need three?).

Yes my point is why have you left it in when it is not needed?

I have been thinking about your problem and the Processing code is a bit odd. It will only change the value of the xpos variable when a byte is received. Therefore if the arduino never sends anything else the movie will keep on playing. What is more, if the call to play the movie is returns before the movie finishes then the requests will just stack up and it will look like the movie is just looping. After the if statement and the call to play the movie you should reset xpos to zero to make sure you don't repeatedly keep on triggering it.

Do you mean change this -

    // If we have 3 bytes:
    if (serialCount > 2 ) {
      xpos = serialInArray[0];
      ypos = serialInArray[1];
      fgcolor = serialInArray[2];

To this? -

    // If we have 3 bytes:
    if (serialCount > 1 ) {
      xpos = serialInArray[0];

I think one of the problems may be that processing isn't registering arduino but not sure how to fix that

processing isn't registering arduino

Do you mean that it is not opening up the correct port?

This has to be changed

  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);

It will open the first port in the list. This isn't necessarily your arduino.

To do this correctly use this:-

String adaptor= "/dev/tty.usbmodem1a21";  // change this to your arduino's port name

void portConnect(){
    int portNumber = 99;
    String [] ports;
    println(Serial.list());
    ports = Serial.list();
      for(int j = 0; j< ports.length; j++) { 
    if(adaptor.equals(Serial.list()[j])) portNumber = j;         
    }
    if(portNumber == 99) portNumber = 0;
    String portName = Serial.list()[portNumber]; 
    println("Connected to "+portName);
    scope = new Serial(this, portName, 57600);
 }

Ok I've changed that and it says unexpected token: void

I added a } above void portConnect(){ which got rid of that error but I now have 'cannot find anything named "adaptor". Do I need to declare this somewhere outside void setup?

I changed adaptor to the portname and the error went away however it now says cannot find anything named scope. This I am stuck with. The code is now as follows

/** 
 * Serial Call-Response 
 * by Tom Igoe. 
 * 
 * Sends a byte out the serial port, and reads 3 bytes in. 
 * Sets foregound color, xpos, and ypos of a circle onstage
 * using the values returned from the serial port. 
 * Thanks to Daniel Shiffman  and Greg Shakar for the improvements.
 * 
 * Note: This sketch assumes that the device on the other end of the serial
 * port is going to send a single byte of value 65 (ASCII A) on startup.
 * The sketch waits for that byte, then sends an ASCII A whenever
 * it wants more data. 
 */
 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[1];    // Where we'll put what we receive
int serialCount = 0;                 // A count of how many bytes we receive
int xpos, ypos;		             // Starting position of the ball
boolean firstContact = false;        // Whether we've heard from the microcontroller

void setup() {
  size(640, 480);  // Stage size
  noStroke();      // No border on the next thing drawn
   movie = new GSMovie(this, "MajorProjectVid.mov");
  movie.loop();
  // 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 adaptor = "/dev/tty.usbmodemfd121";  // change this to your arduino's port name

}

void portConnect(){
    int portNumber = 99;
    String [] ports;
    println(Serial.list());
    ports = Serial.list();
      for(int j = 0; j< ports.length; j++) { 
    if("/dev/tty.usbmodemfd121".equals(Serial.list()[j])) portNumber = j;         
    }
    if(portNumber == 99) portNumber = 0;
    String portName = Serial.list()[portNumber]; 
    println("Connected to "+portName);
    scope = new Serial(this, portName, 57600);
 }


void movieEvent(GSMovie movie) {
  movie.read();
}

void draw() {
  //background(255);
  //fill(fgcolor);
  // Draw the shape
  //ellipse(xpos, height/2, 20, 20);
  if(xpos > 190){
    image(movie,0,0,width, height);
  }else background(0);

}

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;
    }
  }
}


/*

//  Serial Call and Response
//  by Tom Igoe
//  Language: Wiring/Arduino
  
//  This program sends an ASCII A (byte of value 65) on startup
//  and repeats that until it gets some data in.
//  Then it waits for a byte in the serial port, and 
//  sends three sensor values whenever it gets a byte in.
  
//  Thanks to Greg Shakar for the improvements
  
//  Created 26 Sept. 2005
//  Updated 18 April 2008


int firstSensor = 0;    // first analog sensor
int secondSensor = 0;   // second analog sensor
int thirdSensor = 0;    // digital sensor
int inByte = 0;         // incoming serial byte

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
  pinMode(2, INPUT);   // digital sensor is on digital pin 2
  establishContact();  // send a byte to establish contact until Processing responds 
}

void loop()
{
  // if we get a valid byte, read analog ins:
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte = Serial.read();
    // read first analog input, divide by 4 to make the range 0-255:
    firstSensor = analogRead(0)/4;
    // delay 10ms to let the ADC recover:
    delay(10);
    // read second analog input, divide by 4 to make the range 0-255:
    secondSensor = analogRead(1)/4;
    // read  switch, multiply by 155 and add 100
    // so that you're sending 100 or 255:
    thirdSensor = 100 + (155 * digitalRead(2));
    // send sensor values:
    Serial.write(byte(firstSensor));
    Serial.write(byte(secondSensor));
    Serial.write(byte(thirdSensor));                              
  }
}

void establishContact() {
 while (Serial.available() <= 0) {
      Serial.print('A', BYTE);   // send a capital A
      delay(300);
  }
}


*/

You don't understand programming at all do you. You just put lots of errors in the code I sent.
I have not got the libraries so I don't know if there is something else wrong but try this:-

/** 
 * Serial Call-Response 
 * by Tom Igoe. 
 * 
 * Sends a byte out the serial port, and reads 3 bytes in. 
 * Sets foregound color, xpos, and ypos of a circle onstage
 * using the values returned from the serial port. 
 * Thanks to Daniel Shiffman  and Greg Shakar for the improvements.
 * 
 * Note: This sketch assumes that the device on the other end of the serial
 * port is going to send a single byte of value 65 (ASCII A) on startup.
 * The sketch waits for that byte, then sends an ASCII A whenever
 * it wants more data. 
 */
 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[1];    // Where we'll put what we receive
int serialCount = 0;                 // A count of how many bytes we receive
int xpos, ypos;		             // Starting position of the ball
boolean firstContact = false;        // Whether we've heard from the microcontroller
String adaptor = "/dev/tty.usbmodemfd121";  // change this to your arduino's port name

void setup() {
  size(640, 480);  // Stage size
  noStroke();      // No border on the next thing drawn
   movie = new GSMovie(this, "MajorProjectVid.mov");
  movie.loop();
  // 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:
    portConnect();

  // 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.
}

void portConnect(){
    int portNumber = 99;
    String [] ports;
    println(Serial.list());
    ports = Serial.list();
      for(int j = 0; j< ports.length; j++) { 
    if("/dev/tty.usbmodemfd121".equals(Serial.list()[j])) portNumber = j;         
    }
    if(portNumber == 99) portNumber = 0;
    String portName = Serial.list()[portNumber]; 
    println("Connected to "+portName);
    myPort = new Serial(this, portName, 57600);
 }


void movieEvent(GSMovie movie) {
  movie.read();
}

void draw() {
  //background(255);
  //fill(fgcolor);
  // Draw the shape
  //ellipse(xpos, height/2, 20, 20);
  if(xpos > 190){
    image(movie,0,0,width, height);
  }else background(0);

}

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;
    }
  }
}

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;
    }
  }
}