Go Down

Topic: Serial communication with two arduinos (Read 258 times) previous topic - next topic

josecoelho

Hi all, I got a arduino mega and a arduino nano. Connecting TX from one board to RX on other will make me able of serial communication? And do I need to connect the grounds?

CrossRoads

Yes: Rx to Tx, Tx to Rx, Gnd to Gnd.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

josecoelho

And then just using Serial.read() and Serial.write() will do it right?

CrossRoads

Yes. Don't read more than Serial.available() shows is ready.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

josecoelho

Just another question: What is the best way to read, store and send the data? Save it at a character array and after read it all, send it?
The idea (for now, to get something very non specific) is to write text at the serial in COM20 and receive it (then display it on Serial from COM21 and at a LCD display). I'm not sure what is the best way to do such a thing. I'm thinking on creating something like this to save the data: http://forum.arduino.cc/index.php/topic,45629.0.html

Robin2

I wrote a demo illustrating communication between a PC and an Arduino in this Thread. The principles could be applied to your project - probably just by using the Arduino code on two devices with a few changes.

...R

mrburnette


josecoelho

I will try it when I got some spare time. I will post the results when done. Thanks Robin2 and mrburnette.

Go Up