Improved serial port detection in Processing

Processing after v2.1 has an improved method of listing available serial ports.

 // if using Processing 2.1 or later:
 // println(Serial.list());       // old method
 printArray(Serial.list());   // improved function 

This will output the list of serial ports in a much nicer to read format, including port number.

So instead of

/dev/cu.Bluetooth-Incoming-Port /dev/cu.usbserial-DN01JDLP /dev/tty.Bluetooth-Incoming-Port /dev/tty.usbserial-DN01JDLP

you get a nice, clean list:

[0] "/dev/cu.Bluetooth-Incoming-Port"
[1] "/dev/cu.usbserial-DN01JDLP"
[2] "/dev/tty.Bluetooth-Incoming-Port"
[3] "/dev/tty.usbserial-DN01JDLP"

(By the way, in Processing and older versions of Arduino you may see the same port listed as cu and tty. Either will work, but it is recommended to use cu in Arduino and tty in Processing.)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: