Hi, I have an arduino due connected via i2c to a mega. I am using the SDA and SCL channels on the mega which are connected to the SDA and SCL channels on the Due respectively. The two channels are powered by the 3.3 V from the Due, which runs through 1.5k Ohm pullup resistors. When transmitting data from the Due to the mega, I am not receiving any data from the Mega. I am using arduino 1.5.4. Here is the code for the Due:
#include <Wire.h>
#include <Timer.h>
Timer t;
void setup()
{
Serial.begin (9600);
Wire.begin(2);
Serial.println("Starting");
t.every(1000,transmitData);
}
void loop()
{
t.update();
}
void transmitData()
{
Serial.println("Transmitting data...");
Wire.beginTransmission(1);
Wire.write('G');
Wire.endTransmission();
Serial.println("Data transmitted.");
}
And the mega
under setup..
// receive incoming data from uno board for shaft encoder
Wire.begin(1);
Wire.onReceive(receiveEvent);
....
void receiveEvent(int byteCount)
{
Serial.println("Receive event");
while(Wire.available())
{
char c = Wire.read();
Serial.println("received from secondary board");
Serial.println(c);
}
}
The code previously worked fine with connecting to an arduino Uno but when I use the Due I get a very different result. Are there any quirks about the Due I should be aware of, such as the fact it takes 3.3V?