I have never used a library for RTC but I feel that now I might be better if I did. I installed RTCLib_2.0.2 and immediately ran into the mud. It now appears that I need to install yet another library demanded by the first, Adafruit_I2CDevice.h. I have been around long enough to reckon I should have heard of this before, but I haven't and I am wondering if this is the cause of grief that I had with RTCs years ago.
I am also wondering if I simply made a bad choice of library, and there are other RTCLibs around that are fine by themselves.
I just took the first cab off the rank. I certainly didn't expect this complication and I am asking if it is normal, or is there a better way.
I was looking at simplifying setting off NTP. I might yet be able to sort it out without using a library.
DS3231
That's what we often suggest members. Either You fight an enemy or put him on the payroll... Hit the enemy or walk around him...
Sorry I've got no specific recommendation, not playing with RTC yet.
RTCLib has undergone many revisions over the years. There was a major revision with V2.0 which introduced the dependency on Adafruit Bus I/O which contains Adafruit_I2CDevice.h.
I think that the library manager deals with the dependency.
I think the motivation for the major 2.0 revision was to cover more platforms.
I am also wondering if I simply made a bad choice of library
No. I think RTCLib is solid and useful. I use it in many projects, especially if I do not want to use the Time library.
OK, Thanks
I have now looked more closely at the sans-library reset code I use. It is really just a set of wire.write(decToBcd)s, indeed half the code is for normal display after the deed is done. I don't need anything special, just set the time and read the time. I'm guessing the single-line command offered by the library simply disguises nine wire.writes that actually control the RTC..
One thing you might be able to comment on as I haven't got my stuff set up:
Do I have to send all the date/time data every time?
I only need hours and minutes with seconds at zero. I suppose I could just put dummies in.
Adafruit has so many sensors that they were writing the same code over and over again (and when I made Issues on Github about the use of the Wire library, they had to fix all those repositories).
So they combined the accelerator/gyro/compass sensors and added temperature and other sensors as well into a single class.
Some sensor have a SPI bus and some have a I2C interface or both. To avoid writing the same code, they made a class for SPI and a class for I2C. A third class on top of that can select the bus.
They have now 3 or 4 layers of software. Some on this forum think that it was a good decision, some think it was a bad decision.
They did not use a template for the SPI/I2C interface, so now it is not possible to add a sensor that has a different interface. When something is wrong (hardware or software) then the user has to go through 3 or 4 layers of software.
I tried something similar, but I gave up. It is not possible to put every sensor with every weird exception into a single software interface. It is possible to take away the clumsiness from the Wire library with a read() and a write() function with pointers to data, but that's all in my opinion.