Hi,
I encountered a problme using two arduino mega1280 boards to communicate to each other. It didnt work.ardall.
I just follow this link to link the two boards. the pullup resistors I used is 10K
http://www.instructables.com/id/I2C-between-Arduinos/step2/Hardware/
Here is my code for Master:
#include <Wire.h>
#define LED_OUT 13
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}
int x = 0;
void loop()
{
Wire.beginTransmission(5); // transmit to device #5
Wire.send(x); // sends one byte
Wire.endTransmission(); // stop transmitting
x++;
if (x == 10)
x = 0;
delay(100);
}
and for the Slave:
#include <Wire.h>
#define LED_OUT 13
int x;
void setup()
{
Serial.begin(9600);
Wire.begin(5); // join i2c bus with address #5
x = 0;
}
void loop()
{
if(Wire.available())
{
x = Wire.receive();
Serial.println(x);
delay(100);
}
else
{
Serial.println("XXXXXXX");
}
}
Any help will be greatly appreciated.
Thank you