Hi - I'm using the library at: https://github.com/Makuna/Rtc/tree/master/src
to display the time. The example code shows setting of the time from the current time. I need to set the time according to a user input (for a Nixie Clock project), so I'm looking at the function in the library code:
void SetDateTime(const RtcDateTime& dt)
{
// set the date time
_wire.beginTransmission(DS1302_REG_TIMEDATE_BURST);
_wire.write(Uint8ToBcd(dt.Second()));
_wire.write(Uint8ToBcd(dt.Minute()));
_wire.write(Uint8ToBcd(dt.Hour())); // 24 hour mode only
_wire.write(Uint8ToBcd(dt.Day()));
_wire.write(Uint8ToBcd(dt.Month()));
// RTC Hardware Day of Week is 1-7, 1 = Monday
// convert our Day of Week to Rtc Day of Week
uint8_t rtcDow = RtcDateTime::ConvertDowToRtc(dt.DayOfWeek());
_wire.write(Uint8ToBcd(rtcDow));
_wire.write(Uint8ToBcd(dt.Year() - 2000));
_wire.write(0); // no write protect, as all of this is ignored if it is protected
_wire.endTransmission();
}
I'm battling to work out how I can use this function to set the individual hours and minutes:
Something like:
mymin = 10; // for example
myhour = 2; // for example
Rtc.SetDateTime(myhour, mymin)
I'm sure it's simple, but I'm not quite getting what to do at the top level of the code in my sketch.
Thanks and regards
Russell