0
votes

I'm using the Arduino library in Processing. But none of the example sketches are working. I've tried changing the serial port using Arduino.list[0] and Arduino.list[1]. If I choose any higher number it throws an error, so I assume it only sees two serial devices.

My Arduino is connected and working. I have no problem using it through the Arduino application.

What are some other possible problems?

There is an example sketch on page Arduino and Processing that I have been using to troubleshoot.

2
57600 is the baudrate, not the port number. You'll need to explain what problem you are trying to solve. - Hans Passant
what os are you using ? - George Profenza
Thanks @HansPassant I did some more investigation and rewrote my question. - rob-gordon
@GeorgeProfenza I'm running OSX 10.8, and the newest stable release (1.5 I think) of Processing - rob-gordon

2 Answers

1
votes

This page was a big help: http://wiki.processing.org/w/Serial_Issues

Ultimately, using

print(Serial.list()[0]);

and trying numbers until the name of the serial port matched what the Arduino IDE was successfully uploading to was the ticket.

Hope this helps someone in the future.

1
votes

You should see the Arduino board's name in Terminal if you do ls /dev/tty.*. Try to do the ls command before and after plugging in the board to see the effect.

Usually on Macs, it starts with tty.usbmodem and something else, while on a PC it is COM3, COM4, etc. so you could do something like:

void setup(){
    String[] arduinoList = Arduino.list();
    for (int n=0;n<arduinoList.length && arduino==null;++n) {
        if (arduinoList[n].startsWith("/dev/tty.usbmodem")) {
            println("Arduino found at: " + Arduino.list()[n]);
            arduino = new Arduino(this, Arduino.list()[n], 57600);
        }
    }
}