Arduino led control "fade project" with Arrays

i was making some experiments with the “fade example” on the arduino UNO so i make an array and its working but i found something interesting, if i don’t declare the Serial port, it wont work properly does somebody had an idea why??

my program is this

int x;
int myleds[]={3, 5, 6, 9, 10, 11};
int brightness = 0;    
int fadeAmount = 5;    
void setup()  { 
  for (x=0; x<=6; x++){
  pinMode(myleds[x], OUTPUT);
  }
 Serial.begin(9600); //if you comment this line, the leds only fade up and don't fade out anymore
} 
void loop()  { 
  for (x=0; x<=6; x++){
  analogWrite(myleds[x], brightness);  
           }
  brightness = brightness + fadeAmount;
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ; 
  }     
  delay(30);                            
}

Have you tried moving this code to the main loop ?

for (x=0; x<=6; x++)  {  pinMode(myleds[x], OUTPUT);}

Have you tried moving this code to the main loop ?

Have you tried making that loop correct, first? You have 6 elements in the array, and are addressing 7.

Good catch Paul ! I guess that"s why you get the big bucks XD