arduino to arduino communication over serial

Hi,

I'm trying to interface 2 arduinos with each other over serial but have run into some problems.

I've basically hooked up the TX pin on one to the RX pin on the other, and use Serial.print() and Serial.read() to send/receive bytes, but the data doesn't seem to be getting across.

Is this the correct approach to use? If not, how else should I do this?

Thanks!
ZQ

Do you have a common ground? Serial is not 1-wire, so they will need a reference in the commond ground. Just connect the grounds as well and you will be firing off. Just remember to set the serial speed to the same value and cross the rx/tx lines.

I2C is an option. Arduinos pair really well via 2WI, depends on what your trying to do though,

sweet! I got it working. thanks guys :slight_smile: So the TX/RX pins supply power as well right?

Also, how do I get the arduinos communicating over I2C? As in, how do I set addresses for each arduino?

TX and RX dont supply power.

The Wire library allows you to set a address when you create the class.

When using I2C, do I need to connect the arduino's ground pins together like I did for normal serial?

As a rule of thumb, you always need to connect the ground between two devices which talk to each other.

sweet! I got it working. thanks guys :slight_smile: So the TX/RX pins supply power as well right?

Also, how do I get the arduinos communicating over I2C? As in, how do I set addresses for each arduino?

Hi!
What speeds have you got? 9600? 19200? 38000? 57600?....

best

sweet! I got it working. thanks guys :slight_smile: So the TX/RX pins supply power as well right?

Also, how do I get the arduinos communicating over I2C? As in, how do I set addresses for each arduino?

Hi!
What speeds have you got? 9600? 19200? 38000? 57600?....

best

Hi, as in for serial? I used 9600 for serial. I don't think the wire library lets you set a speed

I don't think the wire library lets you set a speed

I believe wire runs at 400kbits. Thats over 400,000 baud when you compare with serial. :slight_smile: