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 & HelpElectronics,  Serial Library › PortInUseException in Windows
Page Index Toggle Pages: 1
PortInUseException in Windows (Read 962 times)
PortInUseException in Windows
Apr 19th, 2010, 1:10pm
 
I'm facing a rather baffling problem:

I have two sketches; both use the serial port. I have two serial ports in the system. If I run the one sketch, it works fine with either port. If I try the other sketch, it can't open either port (throws a port in use exception). Its clear that the ports are free at the time of attempt (it can be opened by Hyperterminal, Arduino, and the *other* sketch).

The main difference between the two sketches is that the second one (that can't open the serial ports) uses the video library as well.

Any ideas why this is happening?
Re: PortInUseException in Windows
Reply #1 - Apr 19th, 2010, 1:55pm
 
ok i've figured it out:

it turns out that I called new on the serial port before the size() function, which results in the setup() being run twice. the second time around the port has already been open.

also, it appears as its only a problem when using the P2D renderer: if I use the default one, it doesn't happen.
Page Index Toggle Pages: 1