I'm a beginner at using Arduino.
I have two Mega 2560 with each 14 SHT7 sensors.
I want to Set one as Master and the other as Slave. Then the Master has to trigger the sampling of the sensors for both boards (trigger a function on the slave board).
I thought of using the I2C connection with SDA and SCL. I already researched how to do the wiring including the 5V with the pull ups.
Both boards have it's own supply voltage of 9-12 volts going into a linear regulator to get 5V.
My question:
The SDA and SCL pins are pin #43 and #44 on the AVR, but #20 and #21 on the board.
Do I have change something with the settings in order to use these pins?
Do I have change something with the settings in order to use these pins?
No.
What "settings" do you think you need to change? There is a trace on the Arduino board connecting the pins on the chip to labeled locations around the periphery of the board. The labels around the periphery correspond to what the code expects to have stuff connected to.
KenF:
The mega2560 has FOUR serial ports. Wouldn't it be simpler to just use one of these to communicate among themselves?
Hi KenF,
I want to use this system with max. 3 slaves. I thought that the I2C connection way the best way, since I'm just sending an x=1 to the slaves to trigger the measuring. I also don't need any data from the slaves.
Isn't the code for the I2C also quite simple compared to the SPI?