int ledPin = 9;  // define the pin the led is connected to
int delayTime = 10; 

void setup()
{
 pinMode(ledPin, OUTPUT); 
}

void loop()                     // run over and over again
{
  for(int i = 0; i <= 200; i++){ //goes through each speed from 255 to 0
    analogWrite(ledPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
  
  for(int i = 200; i >= 0; i--){ //goes through each speed from 255 to 0
    analogWrite(ledPin, i);   //sets the new speed
    delay(delayTime);           // waits for delayTime milliseconds
  }
}