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 › A Separate Serial Port Necessary
Page Index Toggle Pages: 1
A Separate Serial Port Necessary? (Read 1527 times)
A Separate Serial Port Necessary?
Jun 9th, 2010, 12:19am
 
Hello everyone!

I'm hoping someone can give me some direction on a project I'm stuck on. Currently, I have an Arduino with a RFID reader sending information to a Processing app. The Arduino sends RFID tag information to Processing via serial connection and Processing then looks up the id in a database to display information on the computer screen accordingly.

That part I have working.

Now, however, I want Processing to send back to the Arduino a value so that I can do some hardware things depending on what's detected (display text information on a 16x2 LCD display). In Processing, the code to set up the port looks something like this:

Code:
String portnum = Serial.list()[0];
myPort = new Serial(this, portnum, 2400);
myPort.buffer(10);

The baud rate is set to 2400 because that's what the RFID reader communicates in. Now I'm want to send values back to the Arduino, in this case just an arbitrary 'A' (ASCII value 65) with:

Code:
myPort.write(65); 


Where the Arduino simply does a val = Serial.read() But after all my debugging, I don't think anything is being sent back. I suspect that this is not working either because A) myPort is already in use and is busy sending/receiving RFID information and/or B) the baud rate is not 9600 and therefore cannot communicate properly.

Do I need to set up multiple serial ports in order to use the RFID reader while also sending other values to the Arduino (to "do other stuff")? It makes sense that I should be able to do this all on one Arduino, but would it be simpler if I were to just use two Arduinos?

Thanks ahead of time for anyone's help on this! I'm really stuck and I can always count on the community to set me straight!
Page Index Toggle Pages: 1