I2C EasyTransfer Master writes to All - "broadcasting"

Hi ! :slight_smile:

I've connected 3 arduinos nano slaves to one arduino Mega master via I2C

using library EasyTransfer GitHub - madsci1016/Arduino-EasyTransfer: An Easy way to Transfer data between Arduinos

I works fine with the example code : Master writes to one slave or the other.

  //send the data
ET.sendData(I2C_SLAVE#1_ADDRESS);
//and 
ET.sendData(I2C_SLAVE#2_ADDRESS);
//and 
ET.sendData(I2C_SLAVE#3_ADDRESS);

Reading the excellent explanations from Nick Gammon http://www.gammon.com.au I2C - Two-Wire Peripheral Interface - for Arduino

I tried to broadcast to all slaves at the same time

// Written by Nick Gammon
// February 2011
#include <Wire.h>
Wire.beginTransmission (0);  // broadcast to all

the code in the EasyTransfer library is the following

//Sends out struct in binary, with header, length info and checksum
void EasyTransferI2C::sendData(uint8_t i2c_address){
_serial->beginTransmission(i2c_address);

so EasyTransfer.sendData(0); should work
I tried it: it's compiling fine, but the slaves do not received anything...

Can someone enlights me please? :slight_smile:

If you read Nick's page seriously you might have noticed that he explicitly activated the broadcast feature by setting the lowest order bit of the TWAR register:

TWAR = (MY_ADDRESS << 1) | 1;  // enable broadcasts to be received

Your library doesn't do that and as you didn't post your complete code I simply assume you also did not include such code.

indeed! :-[ I'm sorry and relieved!
many thanks to you!

I read it days ago and today testing the example I tried only (0) and forgot this second (mandatory) part!

Mat13:
I read it days ago and today testing the example I tried only (0) and forgot this second (mandatory) part!

So when it did not work as expected it might have been an idea to go back and study the documentation again, just in case you missed something.