Hardware Reference
In-Depth Information
Figure 13-19: Real-time clock circuit assembled on breadboard
Using the RTC Arduino Third-Party Library
As in the preceding chapter, you again use a third-party library to extend the
Arduino's capabilities. In this case, it's to facilitate easy communication with the
real-time clock (RTC) chip. Unsurprisingly, the library is called RTClib . The library
was originally developed by JeeLabs, and was updated by adafruit Industries.
A link to download the library can be found on the web page for this chapter:
www.exploringarduino.com/content/ch13 . Download the library and add it to
your Arduino user library folder, just as you did in the preceding chapter. Make
sure that the folder name has no dashes in it; underscores are okay.
The library is easy to use. The first time you run the example code, you use
the RTC.adjust function to automatically grab the current date/time from your
computer at the time of compilation and use that to set up the clock. From this
point on, the RTC runs autonomously, and you can obtain the current time/
date from it by executing the RTC.now() command. In the next section, you use
this functionality to enable real-time logging.
Search WWH ::




Custom Search