Two Mega 2560 I2C

Hello Community,

I'm trying to use the I2C wiring to create a network of one master and multiple slave boards. For now I'm trying it with just one slave.

The wiring with the SDA, SCL, 5V and GND is already done including the pull ups.

The task is to set a specific sample rate for taking measurements with the master board. When the time for measuring has come, the master starts with its own measurement. Then it sends an x=1 to the slave.

Both the master and the slave are suing the touch screen MI0283QT9 and the rtc DS1307.

i have to implement the master/slave connection into an functioning program. Since the existing code has almost 4000 lines, i will describe my changes.

Master: I added the transmission of x=1 into the measurement function.

Slave: I changed the call requirement of the measurement function to if(x=1) and added the needed code to receive the sent x.

It seems that the triggering from the master is working. When the measuring is called, the first thing to do is to get the current time and date from the rtc. Then I send it to the serial monitor (together with the number of measurements) and show it one the touch screen.

The problem:

From time to time, the date and time shown changes into 0.0.2000;0:0:0. Is there a problem with the rtc?

Greets Carnefix


I found out that both the rtc DS1307 on both board are in the IC2 connection. They have a fixed address 0x68(104) which might be the problem.

Is there a way to deactivate one without having to remove it from the board?

Greets Carnefix