Hi, I just wanted to know how to link up my Arduino with Processing (that's playing a video).
My project is consists of rollers with magnets on the side, so the Arduino can link to a video playing in Processing (also hopefully stop playing when the rollers aren't moving). I had helped with the Arduino side of things but unfortunately my friend is very busy and needs to carry on with his own projects. If anyone could help me out / refer me to someone who I can pay for setting up like this that would be great!
So far:
I have managed to hook up a Hall effect switch to the Arduino and an LED, the hall effect switch detects output from magnets and switches on and off depending on the side of the magnet (North pole / South pole).
Code for Arduino:
int potPin = 0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
int incomingData; // To hold value of data coming through COM port
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.print("hello"); // prints hello with ending line break
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val); // stop the program for some time
//if (Serial.available() > 0){
// Read the value and store in incomingData
incomingData = val;
Serial.println(incomingData);
//}
// If the value of the data is greater than 0 then turn on LED
if (incomingData > 0){
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
Also I have managed to make a video play in Processing, here is the code:
import processing.video.*;
Movie myMovie;
void setup() {
size(600, 600);
frameRate(25);
myMovie = new Movie(this, "wallride.mov");
myMovie.speed(1.0);
myMovie.loop();
}
void draw() {
if(myMovie.available()) {
myMovie.read();
}
image(myMovie, 0, 0);
}