"upgrading" a code

So, let’s start with the begining, I have this code witch is used for lighting my aquarium, it sort of recreates the rissing and setting of the sun, but i would like to make it a bit better, here is the code:

int ledPin = 9;
void setup() {
}
void loop() {
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=1) {
analogWrite(ledPin, fadeValue);
delay(2000);
}
delay(40380000);
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=1) {
analogWrite(ledPin, fadeValue);
delay(2000);
}
delay (45000000);
}

Now what i would like to change, i would like that the fisrt 15 steps of the fading for on position to last 15 sec, and the same goes for the last 15 steps for the off position. Is this thing possible ?

I don’t follow what you mean in that last bit. What do you want to happen?

If (fadeValue > 15){ delay(2000); }else{ delay(15000); }

?

Ok i dit it like this :

int ledPin = 9;
void setup() {
}
void loop() {
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=1) {
    analogWrite(ledPin, fadeValue);
    if (fadeValue > 3){
      delay(20);
    }
    else{ 
      delay(1000);
    }
  }
  delay(1000);

  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=1) {
    analogWrite(ledPin, fadeValue);
    if (fadeValue < 3){
      delay(20);
    }
    else{ 
      delay(1000);
    }
  }
}

it’s fine for the first step, but the led doesn’t turn off at all (i put more observable times), it just stays lit.

le: got the last part mix up, it’s working now, tx for help :slight_smile: