Can't manage to sort a file and display time & date on a LCD screen.

Which means that you MUST set pin 10 as OUTPUT and you can not use it for anything else.

I already set pin 10 as an OUTPUT and there is nothing else on it.

I've figured out why I couldn't read it : the SD card was damaged. The card has been formated but I could only read it once. The card is damaged again.

Everything works perfectly if I ahve the following code :

void setup()
{
   Wire.begin();
   /*
  second = 0;
  minute =45;
  hour = 8;
  dayOfWeek = 7;
  dayOfMonth = 28;
  month = 4;
  year = 14;
  setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);*/
  
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
      
  pinMode(annule, INPUT);//push button initialization
  pinMode(perime, INPUT);
  pinMode(prdt, INPUT);
  pinMode(select, INPUT);
  pinMode(OK, INPUT);
  pinMode(HD, INPUT);
  
  digitalWrite(annule, LOW);
  digitalWrite(perime, LOW);
  digitalWrite(prdt, LOW);
  digitalWrite(select, LOW);
  digitalWrite(OK, LOW);
  digitalWrite(HD, LOW);
  
    
   pinMode(10, OUTPUT);//for SD card
  
  //test : SD card ?
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  
  //reading SD file
  
  myFile = SD.open("liste.txt", FILE_READ);
  if (myFile) {
    Serial.println("Start reading...");
    myFile.seek(0);

   while(myFile.available())
    {
        while(character != '\n')
               {
                 character = myFile.read();
                 tab[x][y]=character;
                 Serial.print(tab[x][y]);
                 y++;
                 delay(10);
               }
               if (character=='\n')
               {
                character='0'; 
                y=0;
               }
               x++;
    }
    
        myFile.close();
    Serial.println("Read.");
     } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");}
  
  //file read.
  //with this as comment
  //start sorting
 /*  x=0;
   Serial.println("Start sorting...");
   
   for (x=0; x<LIGNES;x++)
         {
           for (y=0; y<TAILLE_MAX;y++)
         {
           tabFin[x][y]=tab[x][y];
         }
         }*/
   // x=0; 
  
  lcd.begin(16,2); // initialization LCD screen 

delay(100);
}

Capture.JPG