void setup() {
DDRD = 0xFF;
}

void loop() {

for(int i=0 ; i < 8; i++){
  PORTD = PIND |= 1<<i;
  delay(500);
}
for(int j=7 ; j > -1; j--){
  PORTD = PIND &= ~(1<<j);
  delay(500);
}
}