#include #include #define SLAVE_1 1 #define SLAVE_2 5 SoftwareSerial mySerial(3, 4); // RX, TX void setup() { Wire.begin(); // join i2c bus (address optional for master) mySerial.begin(9600); mySerial.println("start"); } byte x = 0; void loop() { Wire.beginTransmission(SLAVE_1); // transmit to address Wire.write(x); // sends one byte Wire.endTransmission(); // stop transmitting delay(1000); Wire.beginTransmission(SLAVE_2); // transmit to address Wire.write(x); // sends one byte Wire.endTransmission(); // stop transmitting delay(1000); x = (x == 0) ? 1 : 0; }