import processing.io.*; import processing.serial.*; //import processing.video.*; import gohai.glvideo.*; Serial port; // ----------------------- camera --------------------------------------------------------------------------------- //Capture video; GLCapture video; PImage img; boolean takePicture = true; int videoWidth = 480; int videoHeight = 240; int sending = 0; void setup() { size(480, 240, P2D); frameRate(10); colorMode(HSB, 100, 100, 100); String portName = Serial.list()[0]; port = new Serial(this, portName, 9600); String[] cameras = GLCapture.list(); video = new GLCapture(this, cameras[0], width, height, 10); video.start(); GPIO.pinMode(4, GPIO.INPUT); // video = new Capture(this, width, height); // video.start(); background(0); delay(2000); } void draw() { ephPercentage(); if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){ takePicture = false; delay(4000); video.pause(); makePicture(); } if(GPIO.digitalRead(4) == GPIO.HIGH && takePicture == false){ takePicture = true; video.start(); } } void keyPressed() { println(int(key)); if (key == 'S' || key == 's') { video.pause(); makePicture(); } if (key == 'B' || key == 'b') { backupFrame(); } if (key == 'G' || key == 'g') { video.start(); } if (key == 'U' || key == 'u') { sendMessage(C_TAG, colorByteValues); } if (key == '1' || key == '2' || key == 3 || key == 4 || key == 5 || key == 6 || key == 7 || key == 8) { for(int i = 0; i