Thank all of you
Well, I changed the function getDate like James C4S told me, I'm using char instead of String and with the PeterH's freemem() I can tell more free memory. Before my memory went down until 693 and now it's 1052, perfect!!
Regards
New Code:
void getDate(byte *second, byte *minute, byte *hour, byte *dayOfWeek, char *STRdayOfWeek, byte *dayOfMonth, byte *month, byte *year)
{
char Date[21];
Date[0] = '\0';
char aux[3];
aux[0] = '\0';
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0);
Wire.endTransmission();
Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
*second = bcdToDec(Wire.receive() & 0x7f);
*minute = bcdToDec(Wire.receive() & 0x7f);
*hour = bcdToDec(Wire.receive());
*dayOfWeek = bcdToDec(Wire.receive() & 0x3f);
*dayOfMonth = bcdToDec(Wire.receive());
*month = bcdToDec(Wire.receive());
*year = bcdToDec(Wire.receive());
if(*hour < 10)
strcat(Date, "0");
itoa(*hour,aux,10);
strcat(Date,aux);
strcat(Date, ":");
if(*minute < 10)
strcat(Date, "0");
itoa(*minute,aux,10);
strcat(Date,aux);
strcat(Date, ":");
if(*second < 10)
strcat(Date, "0");
itoa(*second,aux,10);
strcat(Date,aux);
strcat(Date, " ");
switch (*dayOfWeek) //dayOfWeek
{
case 1:
strcat(STRdayOfWeek,"Lu");
strcat(Date, "Lu");
break;
case 2:
strcat(STRdayOfWeek,"Ma");
strcat(Date, "Ma");
break;
case 3:
strcat(STRdayOfWeek,"Mi");
strcat(Date, "Mi");
break;
case 4:
strcat(STRdayOfWeek,"Ju");
strcat(Date, "Ju");
break;
case 5:
strcat(STRdayOfWeek,"Vi");
strcat(Date, "Vi");
break;
case 6:
strcat(STRdayOfWeek,"Sa");
strcat(Date, "Sa");
break;
case 7:
strcat(STRdayOfWeek,"Do");
strcat(Date, "Do");
break;
}
strcat(Date, " ");
if(*dayOfMonth < 10)
strcat(Date, "0");
itoa(*dayOfMonth,aux,10);
strcat(Date,aux);
strcat(Date, "/");
if(*month < 10)
strcat(Date, "0");
itoa(*month,aux,10);
strcat(Date,aux);
strcat(Date, "/");
if(*year < 10)
strcat(Date, "0");
itoa(*year,aux,10);
strcat(Date,aux);
lcd.print(Date);
}