I know this is probably a no-brainer for some of you...
I have completed a project using Processing and have it set up so that certain keypresses do certain things. It's now time to put the installation together.
All I want to do is use simple switches hooked up to the Arduino to take the place of the keypresses in my Processing sketch. How can I tell processing which pins to assign to each of my different actions? I have followed this tutorial
http://arduino.cc/en/Tutorial/Graph and I get it but can't figure out how to take in readings from separate pins...
First post here, though I've been using the forum for help for a while. Couldn't think of a suitable title for the thread...
I've got a camera and projector set up pointing at a surface and part of what I need to do is (on a key press) project a black filled window for a moment, so that the projector projects nothing, and in this time have the camera capture a still image of whatever is in the frame. Then I want to project that image afterwards. This is just a small part of a bigger project so it might not make sense why I would want to do that.
Anyway, the problem I'm having is getting the camera to capture during this time period (which is set to 1 second for the moment). The way it's working currently is that it's capturing the frame immediately before the black second is projected.
This is the code so far. I have made several attempts trying to get cam.read(); to work at 500 milliseconds but it hasn't worked. Any help would be greatly appreciated. Thanks!
import processing.video.*;
int captureTimerStart;
int delaytime = 1000;
boolean timer = false;
Capture cam;
PImage scene; // "scene" is the main projected image that will be updated with each new capture
void setup()
{
size(1400, 1050); // 1400 by 1050 is the correct size for setup uding MacBookPro laptop and InFocus projector
scene = loadImage("sceneTest.jpg");
image(scene, 0, 0);
cam = new Capture(this, 1400, 1050);
cam.settings(); // choose camera and quality settings
}
void draw()
{
if(keyPressed)
{
if (key == 'b' || key == 'B' && timer == false) // if 'b' is pressed and timer is not running
{
captureTimerStart = millis();
//captureTimer = millis();
timer = true; // start the timer
fill(0); // set colour to black
rect(0, 0, 1400, 1050); //project a blank frame
cam.read(); //capture the current frame
}
}
if (millis() - captureTimerStart >= delaytime) // when timer reaches zero