Hi, i have a problem, cause i tried to open a Processing code (Capture with webcam) when the PIR sensor activates (Controlled by Arduino), but when something moves, the arduino dont call processing so, theres is my question: ¿How could i call processing from arduino when the pir codes calls?
Heres the codes that im using.
ARDUINO:
#include <Firmata.h>
int sensorPIR = 4;
long tiempoEncendido = 120000; // Tiempo en mili-segundos (30 SEG)
int PIRactivo=0;
long contador = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if ( PIRactivo==HIGH ) {
Serial.print("O");
delay(3000);
} else {
Serial.print("N");
}
delay(500);
}
PROCESSING:
import processing.video.*;
Capture cam;
void setup() {
size(640, 480);
// If no device is specified, will just use the default.
cam = new Capture(this, 320, 240);
// To use another device (i.e. if the default device causes an error),
// list all available capture devices to the console to find your camera.
//String[] devices = Capture.list();
//println(devices);
// Change devices[0] to the proper index for your camera.
//cam = new Capture(this, width, height, devices[0]);
// Opens the settings page for this capture device.
//camera.settings();
}
void draw() {
if (cam.available() == true) {
cam.read();
image(cam, 160, 100);
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(160, 100, cam);
}
}