I'd like to run a film from a hard drive using a sensor so that the film starts playing when the viewer enters. I want the first frame to be projected as a still image until someone walks in, causing the video to begin playing. Afterwards, I want the film to return to the first frame, ready to play again when someone else enters. It'll be a really short film, about 30 seconds. I have coded for the sensor to control a digital out. How do I go about controlling a video file on a computer, using the arduino? Do I need any special equipment or software? No idea where to start looking. If someone could point me in the right direction, it'd be a big help.

Hi guys. I have since got something to run in Processing, with the film split into stills at 25fps. Both Processing and Arduino sketches run fine with a push button, but I'm having trouble adapting the code to get Processing to read the PING as a switch. I want arduino to trigger processing when the distance is less than 33 inches. Have been on this for days. Any ideas where I'm going wrong? I know it's quite an old post, so will repost if I don't hear back.

void loop(){ // establish variables for duration of the ping, // and the distance result in inches and centimeters: long duration, inches;

// The PING))) is triggered by a HIGH pulse of 2 or more microseconds. // Give a short LOW pulse beforehand to ensure a clean HIGH pulse: pinMode(pingPin, OUTPUT); digitalWrite(pingPin, LOW); delayMicroseconds(2); digitalWrite(pingPin, HIGH); delayMicroseconds(5); digitalWrite(pingPin, LOW);

// The same pin is used to read the signal from the PING))): a HIGH // pulse whose duration is the time (in microseconds) from the sending // of the ping to the reception of its echo off of an object. pinMode(pingPin, INPUT); duration = pulseIn(pingPin, HIGH);

// Serial.println(duration); // Print value to serial monitor

// If there is a an object less than 33 inches from the sensor send 1 to // processing, otherwise send 0. (Number of microseconds divided by 74 // gives ms per inch. Half this value gives the distance of the object)

Open the Serial Monitor, instead of Processing. Do you see the 0 and 1 appear there? Probably not, since 0 and 1 are not ASCII characters. So, the question becomes why are you sending the values as bytes instead of characters?

What does your Processing code look like? It's difficult to diagnose a sender/receiver problem when you only post the sender code and don't describe the problem.

Ok. Processing code is below, as is original pushbutton code for arduino. Am not getting anything in the serial monitor. I am using bytes because the code I had for a push button sends bytes, and this worked perfectly with the processing code so I thought I could just change the if statement? I haven't yet learned about ASCII. Can you explain why I need to use these instead?

// variables int trigger= 0; // has the ultrasonic been triggered?int frames = 1; // frame counter, so we know when we're at the endint numOfFrames = 239; // the number of frames in your movie MINUS ONEint val; // Data received from the serial port

println(Serial.list()); // prints list of serial ports // 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.

// UNCOMMENT NEXT TWO LINES // String portName = Serial.list()[1]; // chose the right one from the list that printed out // port = new Serial(this, portName, 9600);}

In your Processing sketch, you declare a variable of type Serial, but you never assign it a value. In addition, you are not providing a serialEvent callback. How can you expect to read serial data without doing these two steps?

Code needs to be posted using the # button, which includes tags that the forum uses to prevent characters in a post from being interpreted. The sequence of characters [, i, and ] in your code tell the forum software to display the rest of the text in italics. Makes understanding what you are trying to do with that array kind of hard.

just to add another possible solution, that may be much simpler if you want to add different videos.There are a lot of VJ software or Multitrack Audio/Video software, which accept MIDI signals as triggers. (for ex, on a C 4th octave play the video n°2, on E play n°4 ect..)sending MIDI notes out of Arduino is really simple. Hardware part is very simple too.This way (maybe for future installations) you can have different sensors, each one triggering different Videos, just adding another Note generated by another sensor (maybe 6 lines of code more.)

Only just revisited this post so not sure if it's still relevant to you ... but, the code I was using also had audio (which I didn't post because mine was silent). I can post it if helpful, so that you can take out the bits that apply to you. Alternatively, I ended up using a relay switch to trigger a DVD player when the viewer passed a sensor. It was a bit clumsy for my installation (since there was a symbol from the DVD player that appeared in the projection whenever the switch was triggered), but since yours is purely audio, this might be a good workaround for you.

Also, thanks to all those that posted replies. I've been using MaxMSP for the past few months and only really tried Processing once before but feel I want to learn to code, so am getting into Processing alongside learning C++. Just wanted to say how great it is that this is available open source.