Hi,
I don't understand something.
I got a class method that does this job :
void FunctionalTasks::setRealTimeClock() {
if ( _Tracer!=NULL )
{
_Tracer->Print("Heures du systeme embarque mise a jour.");
}
// MODULE HORLOGE TEMPS REEL EMBARQUEE
RTC.stop();
// REGLAGE HEURE
RTC.set(DS1307_HR , 19); // set the hours
RTC.set(DS1307_MIN , 55); // set the minutes
RTC.set(DS1307_SEC , 0); // set the seconds
// REGLAGE DATE
RTC.set(DS1307_DATE , 17); // set the date
RTC.set(DS1307_MTH , 12); // set the month
RTC.set(DS1307_YR , 10); // set the year
RTC.set(DS1307_DOW , 5 ); // set the day of the week
RTC.start();
}
Ok so I launch my sketch with that setup:
void setup() {
// SERIAL
Serial.begin(9600);
// LCD
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.clear();
delay(2000);
// pass lcd to tracer and tracer to all others objects
Tracer.setLcd(&lcd);
delay(200);
// FuncTask.setSonicSensor(&sonicsensor);
UltraCmd.setSonicSensor(&sonicsensor);
FuncTask.setTracer(&Tracer);
PinMng.setTracer(&Tracer);
FuncTask.setPinManager(&PinMng);
FuncTask.setRealTimeClock(); //!!! only if date is out of date
Ok so the time is well displayed on my LCD screen.
Then I comment the line
FuncTask.setRealTimeClock();
And then upload the sketch with the line commented.
Then running again my sketch, the date is bad. and day of the week return 0 until 5 as in the first test.
This is my func to get the day title of the week :
String getDayOfWeek( )
{
String days[8]={ "Jour NaN", "Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche" };
return days[RTC.get(DS1307_DOW, false)];
}