void Clock::begin()
{
if (!ds3231.begin())
{
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
}
void Clock::loop()
{
if (millis() - lastTimeUpdateRTC > 1000)
{
DateTime now = ds3231.now();
hour = now.hour();
minute = now.minute();
second = now.second();
weekDay = now.dayOfTheWeek(); //dayOfTheWeek return 0-6
day = now.day();
month = now.month();
year = now.year();
Serial.println(weekDay);
Serial.print(day);
Serial.print("/");
Serial.print(month);
Serial.print("/");
Serial.println(year);
Serial.print(hour);
Serial.print(":");
Serial.print(minute);
Serial.print(":");
Serial.println(second);
lastTimeUpdateRTC = millis();
}
}