   initRollupOutput(1, ROLLUP_OPEN[0], ROLLUP_CLOSE[0], LOW);
   initFanOutput(1,FAN[0], LOW);
   initHeaterOutput(1,CHAUFFAGE[0], LOW);
-  initHeaterOutput(2,CHAUFFAGE[1], LOW);
 
   pinMode(LCDKEYPAD, INPUT_PULLUP);
   pinMode(SAFETY_SWITCH[0], INPUT_PULLUP);
-  pinMode(SAFETY_SWITCH[1], INPUT_PULLUP);
   pinMode(MENU_PIN, INPUT_PULLUP);
   //Affichage LCD
   lcdDisplay();

  initLCD(20,4);
  initTimeLord();

  defineProgram(1, SR, 0, -30, 20);
  defineProgram(2, SR, 0, 20, 21);
  defineProgram(3, CLOCK, 11, 10, 22);
  defineProgram(4, SS, 0, -60, 28);
  defineProgram(5, SS, 0, -2, 18);

  defineRollup(1, 5, 1, 1, 0, 1, false);
  defineFan(1, 2, 1, false);
  defineHeater(1, -3, 1);
  defineHeater(2, -5, 1);
  defineRamping(5);

  initVariables();
  initOutputs();

}

void selectProgram(){
  //Exécution du programme
  setSunrise();
  setSunset();
  getDateAndTime();
  setPrograms();
  selectActualProgram();
}

void setPrograms(){
  int PInt[nbPrograms][3] = {};
  for(byte x = 0; x < nbPrograms; x++){
    //Serial.println(x);Serial.println (programType[x]);
    if (programsE(x) == SR){
      PInt[x][HEURE] = sunRise[HEURE];
      PInt[x][MINUTE] = sunRise[MINUTE] + srmodE(x);
      convertDecimalToTime(&PInt[x][HEURE], &PInt[x][MINUTE]);
      //Serial.print(" Program ");Serial.print(x);Serial.print(" : ");Serial.print(P[x][HEURE]);Serial.print(" : ");Serial.println(P[x][MINUTE]);
    }
    else if (programsE(x) == CLOCK){
      PInt[x][HEURE] = PROGRAM_TIME(x, HEURE);
      P[x][MINUTE] = PROGRAM_TIME(x, MINUTE);
      //Serial.print(" Program ");Serial.print(x);Serial.print(" : ");Serial.print(P[x][HEURE]);Serial.print(" : ");Serial.println(P[x][MINUTE]);
    }

    else if (programsE(x) == SS){
      PInt[x][HEURE] = sunSet[HEURE];
      PInt[x][MINUTE] = sunSet[MINUTE] + ssmodE(x);
      convertDecimalToTime(&PInt[x][HEURE], &PInt[x][MINUTE]);
      //Serial.print(" Program ");Serial.print(x); Serial.print(" : "); Serial.print(P[x][HEURE]);Serial.print(" : ");Serial.println(P[x][MINUTE]);
    }
  }
  //Convert to byte
  for(byte x = 0; x < nbPrograms; x++){
      for(byte y = 0; y < 3; y++){
        P[x][y] = (byte)PInt[x][y];
      }
  }
}



void selectActualProgram(){
  //Sélectionne le programme en cour
    //Serial.print ("Heure actuelle ");Serial.print(" : ");Serial.print(sunTime[HEURE] );Serial.print(" : ");Serial.println(sunTime[MINUTE]);
    for (byte y = 0; y < (nbPrograms-1); y++){
    //Serial.print ("Programme "); Serial.print(y+1);Serial.print(" : ");Serial.print(P[y][HEURE]);Serial.print(" : ");Serial.println(P[y][MINUTE]);
      if (((sunTime[HEURE] == P[y][HEURE])  && (sunTime[MINUTE] >= P[y][MINUTE]))||((sunTime[HEURE] > P[y][HEURE]) && (sunTime[HEURE] < P[y+1][HEURE]))||((sunTime[HEURE] == P[y+1][HEURE])  && (sunTime[MINUTE] < P[y+1][MINUTE]))){
          program = y+1;
          //Serial.println("YES!");
        }
    }
    //  Serial.print ("Programme ");Serial.print(nbPrograms);Serial.print(" : ");Serial.print(P[nbPrograms-1][HEURE]);Serial.print(" : ");Serial.println(P[nbPrograms-1][MINUTE]);
    if (((sunTime[HEURE] == P[nbPrograms-1][HEURE])  && (sunTime[MINUTE] >= P[nbPrograms-1][MINUTE]))||(sunTime[HEURE] > P[nbPrograms-1][HEURE])||(sunTime[HEURE] < P[0][HEURE])||((sunTime[HEURE] == P[0][HEURE])  && (sunTime[MINUTE] < P[0][MINUTE]))){
      program = nbPrograms;
    //Serial.println("YES!");
    }
}


void setSunrise(){
  //Définit l'heure du lever et coucher du soleil
  myLord.SunRise(sunTime); ///On détermine l'heure du lever du soleil
  myLord.DST(sunTime);//ajuster l'heure du lever en fonction du changement d'heure
