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);
Im trying to create some code that loops a quicktime video and once a sensor is triggered plays a different video. So to start i just want to get my video to open in processing. i'm using the loop code found here (
http://processing.org/reference/libraries/video/Movie_loop_.html).
I figure im missing a library or something, iv put the .mov file in the processing folder in my documents but can't seem to get processing to recall it.
im trying to create a post on twitter when i receive data from my accelerometer.
everything works great;
my arduino code runs and recognizes my accelerometer.
my processing sketch recognizes my accelerometer, and posts to twitter.
the problem is that because the accelerometer always has output of around 550 i am constantly posting to twitter.
how do i set a limit in processing. can you write if statements in processing the same way you do in arduino? (im newish to arduino and this is my first attempt at using processing) in my arduino sketch i have if xvalue is greater than 600 serial print in "ollie"
this works in arduino but i don't know how to translate it in processing.
Arduino Code
// these constants describe the pins. They won't change:
const int groundpin = 2; // analog input pin 2 -- ground
const int powerpin = 4; // analog input pin 4 -- voltage
const int zpin = A2; // z-axis of the accelerometer
const int ypin = A1; // y-axis
const int xpin = A0; // x-axis (only on 3-axis models)
int sensorValue;
void setup() {
// initialize the serial communication:
Serial.begin(9600);
}
void loop() {
if(analogRead(zpin)>600)
Serial.println("Ollie");
Serial.println();
// delay before next reading:
delay(100);
}
Processing code (Twitter4j + graph)
/*
Posts a message to a Twitter account when you press the mouse button.
Im new to processing and im trying to get a piece of code i found
here to work. I've imported the library, changed the quotations but it is saying the fuction getOAuthAuthorizedInstance (String, String, AccessToken) does not exist.
From what I've read this is a problem with the setup but being new i don't know what to do... here is my code.
/*
Posts a message to a Twitter account when you press the mouse button.