int pin[] = {2,3,4,5};

void setup() {
  // put your setup code here, to run once:
  for(int i = 0; i < 4; i++){
    pinMode(pin[i],OUTPUT);
  }
}

void loop() {
  // put your main code here, to run repeatedly:
    for (byte val = 0; val < 16; val++){
      byte a = val % 2;
      byte b = val/2 % 2;
      byte c = val/4 % 2;
      byte d = val/8 % 2;
       
      digitalWrite(pin[3],a);
      digitalWrite(pin[2],b);
      digitalWrite(pin[1],c);
      digitalWrite(pin[0],d);
      delay(1000);
    }


}