Loading...

Virtuabotixrtc.h Arduino Library -

The DS1302 uses a 3-wire synchronous serial interface. You can connect it to any three digital pins on your Arduino, but common practice uses pins 2, 3, and 4.

virtuabotixRTC library is a lightweight, widely-used, but aging tool specifically designed for the DS1302 Real-Time Clock (RTC) virtuabotixrtc.h arduino library

delay(1000); // Update every second

The DS1302 is an integrated circuit that acts like a digital wristwatch for microcontrollers. Unlike the standard internal clock of an Arduino—which resets whenever power is lost—the DS1302 often features a and a dedicated crystal oscillator. This hardware ensures that the device maintains accurate time (seconds, minutes, hours, days, months, and years) even when the main system is powered down. Functionality of virtuabotixRTC.h The DS1302 uses a 3-wire synchronous serial interface

VirtuabotixRTC rtc(5, 4); // SCL pin 5, SDA pin 4 Unlike the standard internal clock of an Arduino—which

Once wired, you need to create an object representing your RTC. The constructor requires three arguments: the reset pin, the data pin, and the clock pin.

void setup() rtc.setDateTime(2022, 7, 25, 10, 30, 0);

Go to Top