Processing - how do I change serial ports

Hi guys,

Im having problems with linking Processing and Arduino. When I run the sketch In processing it comes up with this error message >>

/dev/cu.Bluetooth-Incoming-Port /dev/cu.Bluetooth-Modem /dev/cu.usbmodem1411 /dev/tty.Bluetooth-Incoming-Port /dev/tty.Bluetooth-Modem /dev/tty.usbmodem1411
[0] "/dev/cu.Bluetooth-Incoming-Port"
[1] "/dev/cu.Bluetooth-Modem"
[2] "/dev/cu.usbmodem1411"
[3] "/dev/tty.Bluetooth-Incoming-Port"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/tty.usbmodem1411"
RuntimeException: Error opening serial port /dev/cu.Bluetooth-Modem: Port busy
RuntimeException: Error opening serial port /dev/cu.Bluetooth-Modem: Port busy
RuntimeException: Error opening serial port /dev/cu.Bluetooth-Modem: Port busy
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.

This appears to be because Processing is trying to connect to the wrong serial port. How do I change the serial port to the usb input which Arduino is connected to?

Any advice greatly appreciated.

Thanks!

This appears to be because Processing is trying to connect to the wrong serial port.

It is happening because YOU are telling Processing to connect to the wrong port. Why are you doing that?

Im not really sure. The code I am using has been copied from Github so thats why I presume. Do you know how I would go about changing the port?

Thanks

void SerialPortSetup() {

// text(Serial.list().length,200,200);

portName= Serial.list()[PortSelected];
// println( Serial.list());
ArrayOfPorts=Serial.list();
println(ArrayOfPorts);
printArray(Serial.list());
myPort = new Serial(this, portName, 115200);

I presume where it says the port name I should copy and paste in a new value for the correct port?

Apologies, I have found a section of the code where you can select a specific port.

Although even when I manually select port within the code to the correct port. It still tries to read the others and then fails. Do you know why this might be?

Do you know why this might be?

Yes. There is still something wrong with your code. If you don't want to post ALL of your code, please don't bother replying. And, please do NOT post any more snippets.