processing gives gnu.io.PortInUseError w/ arduino

Hi,

This error has been replicated on 3 laptop pcs running windows xp sp 2. Any help would be appreciated

Arduino is working fine with COM7 and is sending data back when checked with arduino ide.

However, when connected to processing 1.35 with the following program:


import processing.serial.*;

String portname = "COM7"; // Change to your port
Serial port; // Create object from Serial class

int val=100; // Data received from the serial port, with an initial value

void setup()
{
// Open the port the board is connected to
port = new Serial(this, portname, 19200);

colorMode(HSB, 255);
size(400, 400);
ellipseMode(CENTER); // draw from center out
noStroke();
frameRate(30);
smooth();
}

void draw()
{
if (port.available() > 0) { // If data is available,
val = port.read(); // read it and store it in val
}
background(99);
// Draw the shape
fill(val,255,255); // we're in HSB mode, so first value is color
ellipse(width/2, height/2, 250,250);
}


The following error is produced:

Stable Library

=========================================

Native lib Version = RXTX-2.1-7

Java lib Version = RXTX-2.1-7

gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)

or a more verbose version of this error is produced:

gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
java.lang.RuntimeException: Error inside Serial.()
at processing.serial.Serial.errorMessage(Serial.java:583)
at processing.serial.Serial.(Serial.java:14
at processing.serial.Serial.(Serial.java:102)
at Temporary_6315_8225.setup(Temporary_6315_8225.java:20)
at processing.core.PApplet.handleDisplay(PApplet.java:1390)
at processing.core.PGraphics.requestDisplay(PGraphics.java:690)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Unknown Source)


same exact program works fine on apple computers when correct com port info is inserted. HELP!!!

Thanks in advance.

Sincerely,

John

Did you try println(Serial.list()); to make sure that COM7 is the right name? (I don't remember if there's a /dev/ in front of it, or if it's lowercased or what.)

how do i do that?

ok, used below version of program in processing.


import processing.serial.*;

Serial port; // Create object from Serial class

int val=100; // Data received from the serial port, with an initial value

void setup()
{
//
println(Serial.list()); // list all of the serial ports
port = new Serial(this, Serial.list()[0], 9600); // Open the port the board is connected to

colorMode(HSB, 255);
size(400, 400);
ellipseMode(CENTER); // draw from center out
noStroke();
frameRate(30);
smooth();
}

void draw()
{
if (port.available() > 0) { // If data is available,
val = port.read(); // read it and store it in val
}
background(99);
// Draw the shape
fill(val,255,255); // we're in HSB mode, so first value is color
ellipse(width/2, height/2, 250,250);
}


gives this info and error on windows xp sp2

Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
[0] "COM4"
[1] "COM7"
[0] "COM4"
[1] "COM7"

gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
java.lang.RuntimeException: Error inside Serial.()
at processing.serial.Serial.errorMessage(Serial.java:583)
at processing.serial.Serial.(Serial.java:148)
at processing.serial.Serial.(Serial.java:102)
at Temporary_9160_7149.setup(Temporary_9160_7149.java:20)
at processing.core.PApplet.handleDisplay(PApplet.java:1390)
at processing.core.PGraphics.requestDisplay(PGraphics.java:690)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Unknown Source)


no idea how to get this to work... ugggg

Try changing:

Serial.list()[0]

to:

Serial.list()[1]

Besides that, I'm not sure, you might ask in the Processing forum.