#include <Wire.h>

#define Slave 0x04

int i=0;
int A[2];

void setup() {
  Serial.begin(9600);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(7,OUTPUT);
  Wire.begin(Slave);
  Wire.onReceive(receivedata);
  digitalWrite(4,LOW);
  digitalWrite(7,LOW);
}

void loop() {

}

void receivedata(int data){
  while(Wire.available()){
    byte ar = Wire.read();
    A[i] = ar;
    i++;
  }
  i = 0;
  analogWrite(6,A[0]);
  analogWrite(5,A[1]);
}

