We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpVideo Capture,  Movie Playback,  Vision Libraries › Error inside Serial.<init>() Serial Problem
Page Index Toggle Pages: 1
Error inside Serial.<init>()? Serial Problem (Read 2854 times)
Error inside Serial.<init>()? Serial Problem
Dec 21st, 2008, 8:24pm
 
I am running processing with an Arduino board. The arduino has scrolling values in its serial monitor read from an analogue input. Processing is due to read them and play a video back at a speed corresponding to these arduino values. (low value = slow vid; High value = fast vid).

Here is my code. (it used to work but stopped when installed on new PC)

// importing the processing serial class
import processing.serial.*;
import processing.video.*;
Movie myMovie;
float filmSpeed = 0.5;

// variables for serial connection, portname and baudrate have to be set
 Serial port;
 String portname = "COM3";  
 int baudrate = 9600;
 int value = 0;  

void setup(){
 // set size and frameRate
 size(500,500);
 background(0);
 myMovie = new Movie(this, "treeMotionJpeg.mov");
 myMovie.speed(filmSpeed);
 myMovie.loop();
 println(Serial.list());
 // establish serial port connection      
 port = new Serial(this, portname, baudrate);
 
}

void draw(){
 image(myMovie, 0, 0);
 // listen to serial port and trigger serial event  
 while(port.available() > 0){
       value = port.read();
       filmSpeed = value / 8;
       myMovie.speed(filmSpeed);
       
       println(value);}
}  

void movieEvent(Movie m) {
 m.read();
}


The error I get is:


gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
at processing.serial.Serial.<init>(Serial.java:136)
at processing.serial.Serial.<init>(Serial.java:102)
at windmillProcessingTotal.setup(windmillProcessingTotal.java:43)
at processing.core.PApplet.handleDraw(PApplet.java:1383)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.<init>()
at processing.serial.Serial.errorMessage(Serial.java:588)
at processing.serial.Serial.<init>(Serial.java:148)
at processing.serial.Serial.<init>(Serial.java:102)
at windmillProcessingTotal.setup(windmillProcessingTotal.java:43)
at processing.core.PApplet.handleDraw(PApplet.java:1383)
at processing.core.PApplet.run(PApplet.java:1311)
at java.lang.Thread.run(Unknown Source)

I am a processing novice so any help would be much appreciated. I need this to work for an exhibition.

Thanks
Re: Error inside Serial.<init>()? Serial Pro
Reply #1 - Jan 6th, 2009, 2:10pm
 
Hi,

did you find any resolution? i'm facing the same problem with a propellor chip...

cheers
Re: Error inside Serial.<init>()? Serial Pro
Reply #2 - Jan 11th, 2009, 10:22am
 
No sorry still having problems. I'm waiting on a new computer so will try it on there as soon as possible and let you know.
In the mean time if anyone else has an idea it would be much apreciated.
Re: Error inside Serial.<init>()? Serial Pro
Reply #3 - Jan 11th, 2009, 4:24pm
 
i had  the same error message because i had put the constructor for the serial port (port=new Serial(...  before the size(... entry in setup.  apparently a no-no.

Re: Error inside Serial.<init>()? Serial Pro
Reply #4 - Jan 16th, 2009, 8:04pm
 
It might very well be that arduino is connecting to a different COM port than on your old computer since there is no fixed port reserved for arduino (or similar chip sets). So if you have not checked that out yet, it might be worth a look.
Re: Error inside Serial.<init>()? Serial Problem
Reply #5 - Apr 30th, 2010, 7:15am
 
"i had  the same error message because i had put the constructor for the serial port (port=new Serial(...  before the size(... entry in setup.  apparently a no-no."

- this was a great help to me, thanks.
 was having the same problem and now it runs fine,
 such a surprisingly simple answer...
Page Index Toggle Pages: 1