Virtuabotixrtch Arduino Library -

VirtuabotixRTCH is an Arduino library designed to work with the Virtuabotix Real-Time Clock (RTC) module. The RTC module is a hardware component that provides a battery-backed clock and calendar, which can be used to keep track of time and date information. The VirtuabotixRTCH library provides a software interface to interact with the RTC module, allowing Arduino users to easily integrate it into their projects.

This library is most commonly used with the , a popular, low-cost timekeeping module that counts time even when the main microcontroller loses power, thanks to an onboard backup battery. Core Features of the VirtuabotixRTC Library

: After calling updateTime() , the library makes the current time available through several public variables. You can access them directly in your code:

To use the library, you must connect the DS1302 RTC module to your Arduino. The DS1302 uses a 3-wire serial interface (distinct from I2C or standard SPI). DS1302 Pin Description Arduino Pin (Example) Power Supply (2.0V - 5.5V) 5V or 3.3V GND CLK Serial Clock DAT Serial Data RST (or CE) Reset / Chip Enable virtuabotixrtch arduino library

The DS1302 RTC module requires five connections: two for power and three for data transfer. Unlike standard SPI or I2C devices, the serial pins on the DS1302 can be connected to on your Arduino board. DS1302 Pin Description Example Arduino Uno Pin VCC Power Supply (2.0V – 5.5V) 5V or 3.3V GND Ground Reference CLK / SCLK Serial Clock Pin Digital Pin 6 DAT / IO Serial Data Input/Output Digital Pin 7 RST / CE Reset / Chip Enable Digital Pin 8 Installing the Library

delay(1000);

The DS1302 uses 3 wires (plus power). Connect as follows: VirtuabotixRTCH is an Arduino library designed to work

The primary functions and public variables exposed by the library include:

#include // Creation of the Real Time Clock Object (SCLK, DAT, RST) virtuabotixRTC myRTC(6, 7, 8); void setup() Serial.begin(9600); // Set time format: seconds, minutes, hours, day of week, day of month, month, year // Day of week: Sunday = 1, Monday = 2, etc. // Run this ONCE to set the clock, then comment it out and re-upload. myRTC.setDS1302Time(00, 30, 15, 2, 21, 4, 2026); void loop() // Always update the time before reading elements myRTC.updateTime(); // Access individual elements Serial.print("Current Time: "); Serial.print(myRTC.hours); Serial.print(":"); Serial.print(myRTC.minutes); Serial.print(":"); Serial.println(myRTC.seconds); delay(1000); Use code with caution. Copied to clipboard IoT cloud rtc problem - Arduino Forum

void setup() lcd.begin(16, 2); lcd.print("RTC Clock"); delay(1000); This library is most commonly used with the

void loop() // Update the time variables from the RTC module myRTC.updateTime();

This is the most reliable method as it ensures you have the specific version of the library the community uses.