What is the best way to connect two Arduino?

Hello, what is the best way to connect two Arduino together to share data? Currently I have an UNO and a Mega. I am looking for both wired and wireless solution.

bbqq:
to share data

First, explain what that actually means.....

The best way is to use wires. Wireless is not as good.

(Perhaps you should supply a little more detail when you ask the question again?)

Thanks. I have a MEGA connecting to some sensors. I plan to connect it to an UNO which also connects to some sensors. The Mega is the main one. I want to get the sensory data collected by UNO and at the same time, be able to send some signals from Mega to UNO.

How far apart?
Do you need to walk between them or close a door or something?
How much data?
How often?
How reliable does it need to be?
Does it need to send data in both directions? (I think you already said this.)
What are the consequences of a single bit error?

Should be fairly simple. First make code you can put on the uno so that you can use the serial monitor to request the sensor data from the uno and display it in the serial monitor.

MorganS:
How far apart?
Do you need to walk between them or close a door or something?
How much data?
How often?
How reliable does it need to be?
Does it need to send data in both directions? (I think you already said this.)
What are the consequences of a single bit error?

The boards are within 30cm distance.
Don't know how much data yet. Probably less than 20 digital/analog data lines.
Continuous data communication
Need to have very reliable data
Yes data sending and receiving in both direction.
No idea about single bit error

The nRF24L01+ wireless modules are cheap and effective. Edit to add - but hardly necessary for a 30cm distance

I got my nRF24s working with this Tutorial

I suggest you use the TMRh20 version of the RF24 library - it solves some problems from the ManiacBug version

The pair of programs in this link may be useful.

...R