Following sketch will stop with an error after a while. The Error message says my mac is out of memory. Everytime i load a new video, i delete the old one, but still it seems that something will fill my memory all the time. Would be very very nice, if someone can see the solution.
import codeanticode.gsvideo.*;
import processing.serial.*;
import cc.arduino.*;
import fullscreen.*;
GSMovie movie;
Arduino arduino;
FullScreen fs;
int state = 0;
int lastState = 0;
Boolean einwurf = false; //
Boolean buttonPressed = false;
Boolean startAmpel = true;
Boolean winner = false;
Boolean info = false; // Debug-Informationen
PFont fontA;
boolean on = true;
void setup() {
size(1680, 1050);
fs = new FullScreen(this);
fs.enter();
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(0, Arduino.INPUT); // Lichtsensor
arduino.pinMode(2, Arduino.INPUT); // Taster
arduino.pinMode(12, Arduino.OUTPUT); // LED
arduino.digitalWrite(12, Arduino.HIGH); // LED an
playVideo("00");
}
void draw() {
checkArduino();
switch(state) {
case 0: // "Insert Coin"-VideoLoop / video00
if (movie.isPlaying() != true) {
playVideo("00");
lastState = 0;
}
if (einwurf == true && lastState != 3) {
lastState = 0;
state = 1;
einwurf = false;
}
break;
case 1:
int zufallsvideo;
if(winner == false){
zufallsvideo = int(random(1,3));
}
else{
zufallsvideo = int(random(3,5));
}
if (movie.isPlaying() != true) {
playVideo("0"+str(zufallsvideo));
lastState = 1;
}
if (buttonPressed == true && lastState != 3) {
state = 2;
buttonPressed = false;
movie.pause();
}
break;
case 2:
if (movie.isPlaying() == false && startAmpel == true) {
playVideo("05");
startAmpel = false;
}
if (movie.isPlaying() == false && startAmpel == false) {
Hey,
i have following problem and I hope one can help me:
1) I created a virtual serial port with:
http://www.eterlogic.com/Products.VSPE.html 2) my Java Project consists of two classes: one establishs the connection to the Serial port and is waiting for receiving bytes, the second one take the same serial port and writes a byte to it.
Problem:
I never receive data the second class sends. If I call
available() i always got
0 as return... so no data are in the serial buffer to read.
Code:
SerialReceive Class
public class SerialReceive extends Thread{
public Serial serial; byte[] inBuffer;
public SerialReceive(PApplet parent) { serial = new Serial(parent, Serial.list()[0], 115200); inBuffer = new byte[1]; }
public SerialSend(PApplet parent, Serial serialDest) { serial = serialDest; inBuffer = new byte[1]; }
public void run() { serial.write(65); // Sending a Testbyte System.out.println(serial.available()); } }
Main class
public void setup(){ serialreceive = new SerialReceive(this); serialreceive.start(); serialsend = new SerialSend(this, serialreceive.serial); serialsend.start(); }
Would be very very nice if someone can help solving this problem.