int led = 11;
int brightness = 0;
int speed = 1;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(led, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  analogWrite(led, brightness);

  brightness += speed;

  if(brightness <=0 || brightness >=255){
    speed = -speed;
    delay(500);
  }

  Serial.println(brightness);

  delay(10);
}