We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Sketch runs great, its acts almost like a zoetrope - We have a bike wheel set up that sends a pulse with each revolution and with that pulse scrubs to the next frame of the video. The problem is that eventually it stops reading after a few minutes. Any ideas why this is happening? Not sure if it is correct usage but using clear() to get rid of any past images that may be hanging around...
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.RaspiPin;
import gohai.glvideo.*;
GLMovie video1;
GpioController gpio;
GpioPinDigitalInput button;
float interval = 0;
void setup() {
size(500, 500, P2D);
gpio = GpioFactory.getInstance();
button = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
video1 = new GLMovie(this, "wheel_1.mp4");
video1.play();
video1.jump(0);
video1.pause();
}
void draw() {
//noCursor();
//whistlesong610pm
if (button.isHigh()) {
println(interval);
clear();
// background(255);
interval = interval + 15 ;
if (video1.available()) {
video1.read();
//float moviePosition = map(mouseX, 0, 20000, 0, 3000);
float moviePosition = interval;
video1.jump(moviePosition);
image(video1, 0, 0, width, height);
}
if (interval >= 18000) {
video1.jump(0);
interval = 0;
}
}
}
Answers
This is working like a charm. Use
delay()
afterif (button.isHigh())