Skip to content

Example (conceptual):

It is for:

Here is an annotated example of how the library is typically used:

Reading the current time from the RTC is just as simple. In your loop() function, you call updateTime() , which refreshes the library's internal variables with the latest data from the RTC chip. You can then directly access the numeric variables ( seconds , minutes , hours , dayofmonth , month , year ) for use in your logic.

line and upload again. Otherwise, the clock will reset to that specific time every time the Arduino restarts. Pin Compatibility:

The Virtuabotix RTC library simplifies the process of using the DS1307 chip with Arduino, allowing users to focus on developing their projects rather than dealing with low-level communication protocols.

: The library provides easy access to individual time elements (e.g., myRTC.hours , myRTC.minutes ) for display on Serial Monitors or LCD screens. Applications and Limitations IoT cloud rtc problem - Arduino Forum

VirtuabotixRTC myRTC(0x68); // typical I2C address for DS1307

void loop() // This allows the library to update the internal time variables myRTC.updateTime();