Force sensor
in
Integration and Hardware
•
1 years ago
Hello everyone,
Im having some coding/syntax problems
im trying to use a force sensor to activate a video during a loop in processing,
i have uploaded standard firmata onto my arduino and incorporated the arduinoinput code into my working code. (at the moment im using a spacebar keystroke to activate the second movie)
i have what i feel should be working but i seem to be getting syntax errors were i didn't have them before. can anyone please help?
- /**
- * Loop.
- *
- */
- import processing.video.*;
- import processing.serial.*;
- import cc.arduino.*;
- Arduino arduino;
- Movie myMovie, your movie;
- void setup() {
- size(960, 540, P2D);
- background(0);
- arduino = new Arduino(this, Arduino.list()[0], 57600);
- for (int i = 0; i <= 13; i++)
- arduino.pinMode(i, Arduino.INPUT);
- // Load and play the video in a loop
- myMovie = new Movie(this, "Movie1.mov");
- myMovie.loop();
- }
- void movieEvent(Movie myMovie) {
- myMovie.read();
- }
- void keyTyped(){
- for (int i = 0; i <= 13; i++) {
- if (arduino.digitalRead(i) == Arduino.HIGH)
- yourMovie = new Movie(this, "Movie2.mov");
- else myMovie.loop();
- {
- yourMovie = new Movie(this, "Movie2.mov");
- }
- }
- void draw
- image(myMovie, 0, 0, width/1, height/1);
- image(yourMovie, 0, 0, width/1, height/1);
- }
1