Hi guys are you sure this code works fine?
DateTime RTClib::now(TwoWire & _Wire) {
_Wire.beginTransmission(CLOCK_ADDRESS);
_Wire.write(0); // This is the first register address (Seconds)
// We'll read from here on for 7 bytes: secs reg, minutes reg, hours, days, months and years.
_Wire.endTransmission();
_Wire.requestFrom(CLOCK_ADDRESS, 7);
uint16_t ss = bcd2bin(_Wire.read() & 0x7F);
uint16_t mm = bcd2bin(_Wire.read());
uint16_t hh = bcd2bin(_Wire.read());
_Wire.read();
uint16_t d = bcd2bin(_Wire.read());
uint16_t m = bcd2bin(_Wire.read());
uint16_t y = bcd2bin(_Wire.read()) + 2000;
return DateTime (y, m, d, hh, mm, ss);
}
(https://github.com/NorthernWidget/DS3231/blob/ae2a8ab0c800a95ea6e5bf505ce223c04fc3f045/DS3231.cpp#L240)
From Datasheet normally you should not use all bits for the hour hh right?
Lets assume you set the clock to 24h mode and set to 19:00.
in the loop....
1.) then plot the hh value. => should be 19.
2.) set to 12h mode hh value is not 7 as expected
You should do the same than in the class like getHour().
Hi guys are you sure this code works fine?
(https://github.com/NorthernWidget/DS3231/blob/ae2a8ab0c800a95ea6e5bf505ce223c04fc3f045/DS3231.cpp#L240)
From Datasheet normally you should not use all bits for the hour hh right?
Lets assume you set the clock to 24h mode and set to 19:00.
in the loop....
1.) then plot the hh value. => should be 19.
2.) set to 12h mode hh value is not 7 as expected
You should do the same than in the class like getHour().