Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
kinichri
kinichri's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Patch takes two images instead of one.
[0 Replies]
12-Dec-2011 01:06 PM
Forum:
Contributed Library Questions
I am trying to build a simple photobooth and I got most of the things in place in my programming.
Except that the patch takes two images instead of one, and randomly selects which one to show.
The patch is as follows:
import codeanticode.gsvideo.*;
import processing.serial.*;
import ddf.minim.*;
Serial arduino;
GSCapture webcam;
Minim minim;
AudioPlayer audio;
boolean takePicture;
void setup() {
takePicture = false;
size(960, 720);
println(Serial.list());
arduino = new Serial(this, Serial.list()[0], 9600);
webcam = new GSCapture(this, 640, 480);
minim = new Minim(this);
audio = minim.loadFile("click.wav");
}
void draw() {
while (arduino.available() > 0) {
int inByte = arduino.read();
println(inByte);
println("Input received, take picture.");
webcam.play();
takePicture = true;
break;
}
if(takePicture && webcam.available() && webcam.isPlaying()) {
audio.play();
while(audio.isPlaying()) {
}
webcam.play();
webcam.read();
image(webcam, 0, 0);
save(String.format("%d-%02d-%02d-%02d-%02d-%02d.jpg", year(),month(),day(),hour(),minute(),second()));
save("nowimage.jpg");
webcam.pause();
println("Input received, take picture2.");
takePicture = false;
}
delay(1000);
}
void stop()
{
audio.close();
minim.stop();
super.stop();
}
This is what it tells me:
49
Input received, take picture.
49
Input received, take picture.
Input received, take picture2.
The sketch on the Arduino has a debounce, which should prevent it from 'pushing' the button twice in a row.
I hope one of you clever people can help me!
«Prev
Next »
Moderate user : kinichri
Forum