Arudino, Processing, and Firmata Help

Hi,

I’ve been struggling with 2 way communication between Arduino and Processing. Currently, they’re both reading and writing to the serial port, but I’ve found that unreliable and ugly. So, I’m trying to use Firmata, figuring that if I can move everything over to Processing, my program becomes more stable.

The problem is, I can’t get Firmata running properly.

I’m got an Arduino NG.
I’m running Processing 1.1
I’m running Arduino 0018

I load the standardFirmata example on to my Arduino board.
I have the following code in processing:

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

Arduino arduino;
int ledPin = 13;

void setup()
{
//println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
}

void draw()
{
arduino.digitalWrite(ledPin, Arduino.HIGH);
delay(1000);
arduino.digitalWrite(ledPin, Arduino.LOW);
delay(1000);
}

I run the processing code, and the LED in pin 13 does nothing. If I run the serial monitor in the Arduino software while I’m dong this, I can see the serial port going bananas, so data is definitely moving, but the LED stays dark.

I’ve tried running OldStandardFirmata, no difference.

Any suggestsions?

You might consider putting Bitlash on the Arduino and sending Bitlash commands to it to control the Arduino. Bitlash is an interpreted language and shell that runs on the Arduino; it's open source and free at http://bitlash.net

You can debug your application using a serial console to figure out the right sequence of Bitlash commands to drive your hardware, and then send those same commands over the serial port from Processing.

-br http://bitlash.net http://entropymouse.com

Thanks for the Bitlash tip, but sending command to the Arduino isn't my problem. I need to go from Arduino to Processing, and fro Processing to Arduino. I haven't gotten the duplex working right yet.

I think I'd like to stick with Firmata, I understand the formating more.

If I run the serial monitor in the Arduino software while I'm dong this, I can see the serial port going bananas, so data is definitely moving, but the LED stays dark.

Only one application at a time can connect to a serial port, on the PC. So, if you are able to open the serial monitor and see data, there is something wrong.

Opening the serial monitor, when the Processing application is running, should generate a run time exception when the serial monitor fails to bind to the com port (which the Processing application has already bound to).

I've been struggling with 2 way communication between Arduino and Processing. Currently, they're both reading and writing to the serial port, but I've found that unreliable and ugly.

The same communication path is being used. I fail to see how the path can be any more reliable with the Firmata sketch running than with your sketch running, unless the problem is in your sketch.

Ugly is in the eye of the beholder. It's also, in this context, a meaningless term. What caused you to use that particular term?

Perhaps the initial problem can be solved, if you describe it better and post some code.

PaulS - In a major face-palm, I just closed the serial monitor in Arduino, and it's all working now.

Clearly, I need to learn more about serial communication. I didn't realize that only one program could access the serial bus at a time.

Thanks!