We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Processing wont communicate with Arduino
Pages: 1 2 
Processing wont communicate with Arduino (Read 9918 times)
Processing wont communicate with Arduino
Jul 12th, 2009, 7:02pm
 
Hey guys,

So im working on an indestructables project that is supposed to rune LED lights that change to music from the arduino board using processing to analyze the frequencies of the input. Problem is, i cant seem to get processing to talk directly to ardunio.

I am running StandardFirmata from arduino and when i run a processing script i can see my port 13 LED flicker, but then arduino doesnt run the program. For example, i was trying to get the 13 LED to blink using this code
Code:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
int ledPin = 13;

void setup()
{
 println(Arduino.list());
 arduino = new Arduino(this, Arduino.list()[2]); // v2
 //arduino = new Arduino(this, Arduino.list()[2], 115200); // v1
 arduino.pinMode(ledPin, Arduino.OUTPUT);
}

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


I am using COM5 on windows vista. I know that COM5 is [2], but they just arent communicating. Any help would be wonderful.
Thanks!
Re: Processing wont communicate with Arduino
Reply #1 - Jul 12th, 2009, 11:29pm
 
I was able to get it working by changing the port name to "COM3" for my hardware.

I am using Win 2K, though.

What does 'println(Arduino.list());' show in Processing?
Which version of Firmata are you using?
Re: Processing wont communicate with Arduino
Reply #2 - Jul 13th, 2009, 8:39am
 
Hmm, I'll try that.I changed the name of my USB serial emulation port to COM5 (from COM4 to see if itd make a difference). I also changed it to a 115200 baud.

println(Arduino.list()); shows

COM1 [0]
COM3 [1]
COM5 [2]

Although I have not been able to connect using COM1 or COM3 using arduino IDE.

Im not positive which version of Firmata i am using, but I only
downloaded the arduino IDE a few months ago.

edit: switched to COM3, no change. And I have firmata v2.1
Re: Processing wont communicate with Arduino
Reply #3 - Jul 14th, 2009, 11:26pm
 
Have you tried any of the examples to verify that those at least work?
Re: Processing wont communicate with Arduino
Reply #4 - Jul 15th, 2009, 9:32pm
 
I tried the examples, no luck. But I did find something odd.

When i run the blink program, while Digital LED 13 doesnt blink, the RX LED on my Arduino Mega blinks at the correct delay that the program suggests. If i change the delay in the processing sketch, then the flashing of the RX LED changes. So i guess that means they are directly communicating, but it still wont run the scripts... any ideas?
Re: Processing wont communicate with Arduino
Reply #5 - Jul 17th, 2009, 1:33am
 
I don't think I understand what scripts you are trying to run.

With the code you posted, yes, the computer and Arduino will communicate directly. In fact, the Processing sketch is controlling the Arduino hardware by sending the proper commands behind the scene.
Re: Processing wont communicate with Arduino
Reply #6 - Jul 17th, 2009, 8:09am
 
What I am using the script for is basicly to make LED pin 13 turn on and off so I can tell that the commands are getting through. The code should simply LED 13 blink, but it hasnt been working.

Im working on a project to make LEDs blink to music, im doing this using Instructables . The problem is when I run the script the LEDs dont turn on/off like they are supposed to. So the blinking script was just a way to test the system, which failed.

Thank you for bearing with me btw, im still new to these systems.
Re: Processing wont communicate with Arduino
Reply #7 - Jul 17th, 2009, 7:04pm
 
Hi folks...I'm having the same problem... I've bought an arduino mega, and it works great as far as i could try...the i uploaded the firmata to the board and then tried some processing sketches... the, analog out and digital in works ok... but the digital out just doesn't worl...
either using the pin13 led or some other led attached to other pin (and changin the pinnumber in the sketch, of course), but the damm led won't turn on....
any ideas? thanks... I'll let you know if i find something...
Re: Processing wont communicate with Arduino
Reply #8 - Jul 17th, 2009, 10:25pm
 
PD : I've noticed that when I make an skecht to turn a digital pin high every 1000 ms, the RX (recieve, right?) led turns blink at that timing... so, the data is reaching the board as I supose...
could it be a problem with the arduino side of the firmata? maybe it' doesn't recognise the pins or something like that?
Re: Processing wont communicate with Arduino
Reply #9 - Jul 18th, 2009, 2:04am
 
Although I don't have a Mega to try, my Duemilanove works as I would expect with your example above.

Could you post an example script you are trying to get working?
Re: Processing wont communicate with Arduino
Reply #10 - Jul 18th, 2009, 9:27am
 
well... an example could be the same script that ginkin99 wrote in the first post... i'm using com5 ( [1] on my list, its the right because its works on the pwnout example or the digitalinput example)
here is again:
Code:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;
void setup(){
 println(Arduino.list());
 arduino = new Arduino(this, Arduino.list()[1]);
 arduino.pinMode(ledPin, Arduino.OUTPUT);
}
void draw(){
 arduino.digitalWrite(ledPin, Arduino.HIGH);
 delay(1000);
 arduino.digitalWrite(ledPin, Arduino.LOW);
 delay(1000);
}
Re: Processing wont communicate with Arduino
Reply #11 - Jul 18th, 2009, 9:38am
 
Im sadly starting to think that it could just be poblem with the mega Sad
Re: Processing wont communicate with Arduino
Reply #12 - Jul 18th, 2009, 9:47am
 
The question is.. is it a problem with the ... with the design of the mega.. or with our megas in particular somehow?
Re: Processing wont communicate with Arduino
Reply #13 - Jul 18th, 2009, 4:12pm
 
There ha got to be a way to modify the code to work on the Mega, it is an arduino system afterall
Re: Processing wont communicate with Arduino
Reply #14 - Jul 18th, 2009, 11:34pm
 
It looks like it may just be Firmata.
http://www.arduino.cc/cgi-bin/yabb2/num_1247199504.html

By chance have you tried any other Arduino sketches like SimpleDigitalFirmata
Pages: 1 2