Virtuabotixrtc.h Arduino Library -

updateTime() — Polls the hardware module to refresh the library variables with current data. 🚀 Step-by-Step Implementation 1. Library Installation

To use this library, you must manually add it to your Arduino IDE .

void loop() myRTC.updateTime();

To get the time from the chip, you must call updateTime() . This fetches the current second, minute, hour, day, date, month, and year from the DS1302 and stores them in the object's public variables.

// CLK, DAT, RST virtuabotixRTC myRTC(6, 7, 8); virtuabotixrtc.h arduino library

void loop() myRTC.updateTime(); Serial.print(myRTC.hours); Serial.print(":"); Serial.print(myRTC.minutes); Serial.print(":"); Serial.println(myRTC.seconds); delay(1000);

void loop() // Nothing to do here

Many modern RTC modules use the DS1307 or DS3231 chips, which communicate via the I2C protocol. However, the DS1302 chip uses a 3-wire serial interface.

Scroll arrow SCROLL DOWN SCROLL DOWN 
×