int i;
#define initial B00000001
#define finale B10000000
void setup(){
DDRD = B11111111;
PORTD = initial;
delay(1000);
}

void loop(){  

if(PORTD == initial){
  for( i=0;i<7;i++){
  PORTD = PORTD << 1;
  delay(1000); 
  }
}
else(PORTD == finale);{
  /*PORTD = initial;
  delay(1000);*/
    for( i=0;i<7;i++){
  PORTD = PORTD >> 1;
  delay(1000); 
}
}
}