I try to interface due with due using wire library,but it does show any output will you please make sort out of this problem Master program: #include <Wire.h>
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
void setup()
{
Wire.begin(4); // join i2c bus with address #4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}
void loop()
{
delay(100);
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
while(1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
}
Also look at reply #33 for some updates to the code.
Check what value pullup resistor you have, if they are only 1K then connecting two Dues together is asking them to sink 6.6mA and that is just over the recommended limit.
thanks a lot sir I connected DUE with DUE through SCL (21) and SDA(20) now it's working ,but still SCL1 and SDA1 not working whether there is any issue ?