Pages: [1]   Go Down
Author Topic: Serial communication with two arduinos  (Read 223 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes: Rx to Tx, Tx to Rx, Gnd to Gnd.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. Don't read more than Serial.available() shows is ready.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, thanks for the quick answer.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 27386
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No problem.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

UK
Offline Offline
Tesla Member
***
Karma: 136
Posts: 7786
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 55
Posts: 1817
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This sketch: http://www.hackster.io/rayburne/the-qbf-signal-generator is capable of Arduino to Arduino & local loopback.

Ray
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 65
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: