|
@ -9,7 +9,7 @@ Serial port; |
|
|
//Capture video; |
|
|
//Capture video; |
|
|
GLCapture video; |
|
|
GLCapture video; |
|
|
PImage img; |
|
|
PImage img; |
|
|
boolean countingColors = false, makeBackup = false, takePicture = true; |
|
|
|
|
|
|
|
|
boolean takePicture = true; |
|
|
int videoWidth = 480; |
|
|
int videoWidth = 480; |
|
|
int videoHeight = 240; |
|
|
int videoHeight = 240; |
|
|
|
|
|
|
|
@ -17,14 +17,14 @@ int sending = 0; |
|
|
|
|
|
|
|
|
void setup() { |
|
|
void setup() { |
|
|
size(480, 240, P2D); |
|
|
size(480, 240, P2D); |
|
|
frameRate(2); |
|
|
|
|
|
|
|
|
frameRate(10); |
|
|
colorMode(HSB, 100, 100, 100); |
|
|
colorMode(HSB, 100, 100, 100); |
|
|
|
|
|
|
|
|
String portName = Serial.list()[0]; |
|
|
String portName = Serial.list()[0]; |
|
|
port = new Serial(this, portName, 9600); |
|
|
port = new Serial(this, portName, 9600); |
|
|
|
|
|
|
|
|
String[] cameras = GLCapture.list(); |
|
|
String[] cameras = GLCapture.list(); |
|
|
video = new GLCapture(this, cameras[0], width, height, 30); |
|
|
|
|
|
|
|
|
video = new GLCapture(this, cameras[0], width, height, 10); |
|
|
video.start(); |
|
|
video.start(); |
|
|
|
|
|
|
|
|
GPIO.pinMode(4, GPIO.INPUT); |
|
|
GPIO.pinMode(4, GPIO.INPUT); |
|
@ -33,23 +33,27 @@ void setup() { |
|
|
// video.start(); |
|
|
// video.start(); |
|
|
|
|
|
|
|
|
background(0); |
|
|
background(0); |
|
|
|
|
|
delay(2000); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void draw() { |
|
|
void draw() { |
|
|
ephPercentage(); |
|
|
ephPercentage(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){ |
|
|
if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){ |
|
|
takePicture = false; |
|
|
takePicture = false; |
|
|
video.pause(); |
|
|
|
|
|
delay(4000); |
|
|
delay(4000); |
|
|
|
|
|
video.pause(); |
|
|
makePicture(); |
|
|
makePicture(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(GPIO.digitalRead(4) == GPIO.HIGH && takePicture == false){ |
|
|
if(GPIO.digitalRead(4) == GPIO.HIGH && takePicture == false){ |
|
|
takePicture = true; |
|
|
takePicture = true; |
|
|
video.start(); |
|
|
video.start(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void keyPressed() { |
|
|
void keyPressed() { |
|
|