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,
Hello!
I've been trying to set off an image when a hand is waved over a sensor plugged into the arduino. Using processing, through firmata, connected with the arduino, I want the image to show up when the input is high. But so far, the image doesn't even pop up. Can anyone help or point me in the right direction?
Here's my code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
color off = color(5, 79, 200);
color on = color(84, 145, 158);
Hello, I'm a beginner at using Firmata with processing. I'm trying to do a project where a movie is set off by a wave of a hand in front of the burglar alarm (with a light based motion detector inside).
I've successfully installed firmata and processing is definitely communicating with the Arduino, but I'm a bit clueless about the coding.
I've used the basic coding for playing a movie (through gsvideo) and added on a few pieces from coding that hints at a reaction from when signal from the Arduino is high.
Here's my code:
import processing.serial.*;
import cc.arduino.*;
import codeanticode.gsvideo.*;
import processing.video.*;
Arduino arduino;
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); }
GSMovie myMovie;
void setup() { size(1280, 720); myMovie = new GSMovie(this, "i.mov"); myMovie.loop(); arduino = new Arduino(this, Arduino.list()[0], 57600); for (int i = 0; i <= 13; i++) arduino.pinMode(i, Arduino.INPUT); }
void draw() { background(off); for (int i = 0; i <= 13; i++) { if (arduino.digitalRead(i) == Arduino.HIGH) image(myMovie, 0, 0); else image(0,0,0); }
void movieEvent(GSMovie m) { m.read(); }
void mousePressed() { myMovie.noLoop(); }
The error that comes up is over the
void movieEvent(GSMovie m) { and it marks it as an unexpected token: void.
Can anyone help or point me in the right direction?