#include <Wire.h>
const int pinLed8 = 8;
const int pinLed9 = 9;
void setup() {
  Wire.begin(9); // Address of slave 1
  Wire.onReceive(receiveEvent); 
  pinMode(pinLed8, OUTPUT);
  pinMode(pinLed9, OUTPUT);
}
void loop() {
  // No code needed 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(pinLed8, HIGH);
      digitalWrite(pinLed9, HIGH);
    } else {
      digitalWrite(pinLed8, LOW);
      digitalWrite(pinLed9, LOW);
    }
  }
}