tilt sensor to trigger movie play

edited November 2014 in Arduino

Hi guys, I wonder if anyone has experience with using the tilt sensor to trigger a movie? I found this script, but there's this error every time I run it. Can someone please help me with the coding or give some advice/ examples?

Thanks!! <3

import org.firmata.*; import processing.serial.*; import processing.video.*; import cc.arduino.*;

Movie myMovie; Arduino arduino;

int inPin = 5; //tilt switch pin

void setup() { println(Arduino.list()); arduino = new Arduino(this, Arduino.list()[0], 115200); arduino.pinMode(inPin, Arduino.INPUT);

size(1650, 1050); background(0);

myMovie = new Movie(this, "movie.mov"); myMovie.speed(1.0); myMovie.play();

}

void movieEvent(Movie myMovie) { myMovie.read(); }

void draw() { background(0);

if (arduino.digitalRead(inPin) == Arduino.HIGH) myMovie.play(); else myMovie.stop();

image(myMovie, 200, 206);

}

Tagged:
Sign In or Register to comment.