#include <Wire.h>
const int pinLed0 = A0;
const int pinLed1 = A1;
void setup() {
  Wire.begin(8); // Address of slave 1
  Wire.onReceive(receiveEvent); 
  pinMode(pinLed0, OUTPUT);
  pinMode(pinLed1, OUTPUT);
}
void loop() {
  // No need for code in the loop of a slave
}
void receiveEvent(int howMany) {
  while (Wire.available()) {
    char data = Wire.read();
    
    // Controls the LED of slave 1
    if (data == '0') {
      digitalWrite(pinLed0, HIGH);
      digitalWrite(pinLed1, HIGH);
    } else {
      digitalWrite(pinLed0, LOW);
      digitalWrite(pinLed1, LOW);
    }
  }
}