Backend / DevOps / Architect
Brit by birth,
located worldwide

All content © Alex Shepherd 2008-2024
unless otherwise noted

Arduino/Processing communication.

Published
1 min read
image
Image Credit: Unknown (if this is your work, reach out to me and I'll credit you!)

Hi folks!

Got a quick fix for you. If you've tried to get Processing communicating with an Arduino, you may find that your Arduino's USB serial port (in my case /dev/ttyACM0) doesn't show up when you try to list serial devices in Processing.

The reason for this, is that the serial libraries in Processing haven't been compiled with support for the Arduino. Fortunately, the Arduino's software is based on Processing, and uses the same libraries, compiled WITH support.

All you need to do is locate the files lib/RXTXcomm.jar, lib/librxtxSerial.so and lib/rxtxSerial64.so within your Arduino software folder, and copy them into the relevant folder in Processing's folder. I had to copy RXTXcomm.jar into modes/java/libraries/serial/library, librxtxSerial.so into modes/java/libraries/serial/library/linux32, and librxtxSerial64.so over modes/java/libraries/serial/library/linux64/librxtxSerial.so.

After I did that, I connected my Arduino, and entered the following code:

import cc.arduino.*;
import processing.serial.*;

println(Arduino.list());

Just as I'd hoped, there was /dev/ttyACM0 written in the console box at the bottom! Now that I've got it working, I'm really looking forward to posting the outcome of some interesting projects I'm working on using the two!

n00b