video set off by sensor- wouldn't play after being set off once
in
Integration and Hardware
•
1 year ago
Hey there, people have been really helpful on this but I have one last problem:
I want to play a movie when an arduino is reading high. I'm going through firmata for talking through processing, and the movie is playing through GSvideo. As of now, the movie plays when the sensor reads high, but when tried again, it wouldn't play again unless I reset the code. I want the movie to play through, and then be open to be played again if the sensor is high,
Here's the code I have so far:
import processing.video.*;
import codeanticode.gsvideo.*;
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
color off = color(0, 0, 0);
color on = color(84, 145, 158);
GSMovie myMovie;
void setup() {
size(1280, 720);
arduino = new Arduino(this, Arduino.list()[0], 57600);
for (int i = 0; i <= 13; i++)
arduino.pinMode(i, Arduino.INPUT);
size(1280, 720);
background(0);
myMovie = new GSMovie(this, "buildings.mov");
}
void draw() {
background(off);
stroke(on);
image(myMovie, 0, 0);
for (int i = 0; i <= 13; i++) {
if (arduino.digitalRead(i) == Arduino.HIGH)
myMovie.play();
}
}
void movieEvent(GSMovie m) {
m.read();
}
Can anyone help?
I want to play a movie when an arduino is reading high. I'm going through firmata for talking through processing, and the movie is playing through GSvideo. As of now, the movie plays when the sensor reads high, but when tried again, it wouldn't play again unless I reset the code. I want the movie to play through, and then be open to be played again if the sensor is high,
Here's the code I have so far:
import processing.video.*;
import codeanticode.gsvideo.*;
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
color off = color(0, 0, 0);
color on = color(84, 145, 158);
GSMovie myMovie;
void setup() {
size(1280, 720);
arduino = new Arduino(this, Arduino.list()[0], 57600);
for (int i = 0; i <= 13; i++)
arduino.pinMode(i, Arduino.INPUT);
size(1280, 720);
background(0);
myMovie = new GSMovie(this, "buildings.mov");
}
void draw() {
background(off);
stroke(on);
image(myMovie, 0, 0);
for (int i = 0; i <= 13; i++) {
if (arduino.digitalRead(i) == Arduino.HIGH)
myMovie.play();
}
}
void movieEvent(GSMovie m) {
m.read();
}
Can anyone help?
1