PWM Max for XX Minutes

Hello,

i want to analogWrite from 0 - 255 and then i will stay at 255 for 0,5 hour. I try it in many ways but it dont work. I hope anybody can help me.

This is the Normal Sketch, where the PWM always continues for 30 Minuits 0 - 255 - 0 - 255 .....

////// Dimmen der LEDs
//
//// Warmweiß
if((now.hour()>=WW_UP_H_M)&&(now.minute()>=WW_UP_M_M)&&(now.hour()<=WW_DN_H_M)&&(now.minute()<WW_DN_M_M)||(now.hour()>=WW_UP_H_N)&&(now.minute()>=WW_UP_M_N)&&(now.hour()<=WW_DN_H_N)&&(now.minute()<WW_DN_M_N))
{
analogWrite(Warmwhite, brightness);
brightness = brightness + fadeAmount; // change the brightness for next time through the loop:
}
if (brightness == 0 || brightness == 255) { // reverse the direction of the fading at the ends of the fade:
fadeAmount = -fadeAmount ;

}
else
{
digitalWrite (Warmwhite, LOW);

}
delay(1000); //Eine Sekunge warten bis der nächste Programm Zyklus startet
}

Seeing the whole program would be a big advantage
Please put it in code tags

rather than in quote tags

ok

//###################################################################
    //#
    //#  Basis Programm von adafruit
    //#  Check http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/understanding-the-code
    //#
    //#  
    //#
    //###################################################################
    
    
    ////// Einfügen der Bibliotheken
    #include <Wire.h>
    #include <RTClib.h>
    RTC_DS1307 RTC;
    
    ////// Variabel deklarieren
    int Blue = 9;                    // LED Pin  9 = Blau
    int Warmwhite = 10;              // LED Pin 10 = Warmweiss                              
    int Coldwhite = 11;              // LED Pin 11 = Kaltweiss 
    int brightness = 0;              // Helligkeit der LED
    int fadeAmount = 5;              // In was für schritten soll die LED gedimmt werden
    
    ////// Zeit Konstanten deklarieren
    //
    //// Blau
    const byte BL_UP_H = 22;          // Konstante "Licht an Stunde"
    const byte BL_UP_M = 0;           // Konstante "Licht an Minute"
    const byte BL_DN_H = 22;          // Konstante "Licht aus Stunde"
    const byte BL_DN_M = 30;          // Konstante "Licht aus Minute"
    //// Warmweiß Sonnenaufgang
    const byte WW_UP_H_M = 9;         // Konstante "Licht an Stunde"
    const byte WW_UP_M_M = 50;        // Konstante "Licht an Minute"
    const byte WW_DN_H_M = 10;        // Konstante "Licht aus Stunde"
    const byte WW_DN_M_M = 10;        // Konstante "Licht aus Minute"
    //// Warmweiß Sonnenuntergang
    const byte WW_UP_H_N = 21;        // Konstante "Licht an Stunde"
    const byte WW_UP_M_N = 30;        // Konstante "Licht an Minute"
    const byte WW_DN_H_N = 21;        // Konstante "Licht aus Stunde"
    const byte WW_DN_M_N = 45;        // Konstante "Licht aus Minute"      
    //// Kaltweiß
    const byte CW_UP_H = 10;          // Konstante "Licht an Stunde"
    const byte CW_UP_M = 0;           // Konstante "Licht an Minute"
    const byte CW_DN_H = 21;          // Konstante "Licht aus Stunde"
    const byte CW_DN_M = 30;          // Konstante "Licht aus Minute"
   
      
    
    static int fadevalue = 255;      // Standard Tages Wert
    static int fading = 0 ;          // 1 ... 2040 = up , -2040 ... -1 = down, 0 = fadevalue bleibt stehen  
    


    
    ////////// Programm vorbereitungen
    void setup () 
    {
    Serial.begin(57600);            //Serial Monitor mit einer Baudrate von 57600 ansteuern
    Wire.begin();                   // ?!?!?!?!?!?
    RTC.begin();                    //Uhrzeit ausgabe starten
       
    
    // Pins deklarieren
    pinMode (Blue, OUTPUT);         // Pin  9 als Ausgang deklariert
    pinMode (Warmwhite, OUTPUT);    // Pin 10 als Ausgang deklariert
    pinMode (Coldwhite, OUTPUT);    // Pin 11 als Ausgang deklariert  
   }
    ////////// Programm Zyklus
    void loop () 
    
    ////// Uhrzeit auf dem Serial Monitor ausgeben
    {
    DateTime now = RTC.now();
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();        
   
    ////// Dimmen der LEDs
    //
    //// Blau
    if((now.hour()>=BL_UP_H)&&(now.minute()>=BL_UP_M)&&(now.hour()<=BL_DN_H)&&(now.minute()<BL_DN_M))
    {
    digitalWrite(Blue, HIGH);
    }     
    else
    {
    digitalWrite (Blue, LOW);
    }
    //// Warmweiß 
    if((now.hour()>=WW_UP_H_M)&&(now.minute()>=WW_UP_M_M)&&(now.hour()<=WW_DN_H_M)&&(now.minute()<WW_DN_M_M)||(now.hour()>=WW_UP_H_N)&&(now.minute()>=WW_UP_M_N)&&(now.hour()<=WW_DN_H_N)&&(now.minute()<WW_DN_M_N))
    {
    analogWrite(Warmwhite, brightness);
    brightness = brightness + fadeAmount;  // change the brightness for next time through the loop:
     }
    if (brightness == 0 || brightness == 255) {  // reverse the direction of the fading at the ends of the fade:
    fadeAmount = -fadeAmount ;
    
    }         
    else
    {
    digitalWrite (Warmwhite, LOW);
    }  
    
    
    
    //// Kaltweiß
    if((now.hour()>=CW_UP_H)&&(now.minute()>=CW_UP_M)&&(now.hour()<=CW_DN_H)&&(now.minute()<CW_DN_M))
    {
    digitalWrite(Coldwhite, HIGH);
    }     
    else
    {
    digitalWrite (Coldwhite, LOW);
    }  
    delay(1000);                     //Eine Sekunge warten bis der nächste Programm Zyklus startet    
    }