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?
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?
1