#include <Wire.h>

#define Slave 0x04

int i;
int ARR[4];

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

void loop() {

}

void point(){
  Serial.println("hi");
}

void receivedata(int data) {
  while (Wire.available()) {

    byte ar = Wire.read();
    ARR [i] = ar;
    Serial.println(ARR[i]);
    i++;
    
  }
  i=0;
  
  digitalWrite(4,ARR[0]);
  digitalWrite(7,ARR[1]);
  analogWrite(5,ARR[2]);
  analogWrite(6,ARR[3]);
  
 
}

