One Master and two slaves using Mega 2560

Hello, I have two spare Mega 2560 and one spare Mega 2560 R3. On the internet, there are conflicting information. Some said that the Mega 2560 (R3) have two independent pairs of I2C (e.g. SDA1, SCL1, SDA2, SCL2) while others said that they are actually connected and thus only one pair. One post also suggested using a breadboard to connect the SDA from all three Arduinos together in one group and the SCL from the three boards into another group.

Who is correct? What is the proper way to do it if I want one master to control two independent slaves?

Only SDA and SCL. That they're NOT numbered (SDA1/SDA2) is a solid indication that it's the same signal.

Beyond that, you could go read the datasheet(set aside an afternoon):

Again, you will find no SDA2/SCL2.

For the rest, see section 24.2 of the datasheet above.

Thank you. In this case, what is a good way to connect and control two slave Mega 2560 independently?

In my case, can I treat the two slave Mega 2560 as two I2C devices?

Multiple I2C [Solved] - Projects / General Guidance - Arduino Forum

Explain "independently" please. I've never done slave programming for I2C, but I would expect that you can use two different addresses to make them work as slaves for the third Arduino.
There are threads in this forum about programming as slaves, so you should be digging for those if you haven't.

What's the great attraction of I2C? Wouldn't it be simpler to use the serial ports?

2 Likes

What do you mean by "good"?

can I treat the two slave Mega 2560 as two I2C devices?

You MUST treat them as two I2C devices

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.