Virtuabotixrtc.h Arduino Library Today

#include <VirtuabotixRTC.h> // Pin connections: CLK, DAT, RST VirtuabotixRTC myRTC(6, 7, 8);

| DS1302 Pin | Arduino Pin | |------------|--------------| | VCC | 5V | | GND | GND | | CLK | 6 | | DAT | 7 | | RST | 8 |

void loop() myRTC.updateTime();

In this post, we’ll dive deep into what makes this library special, how to install it, and walk through practical examples to get your Real Time Clock (RTC) running in minutes. The VirtuabotixRTC library is designed specifically for the DS1302 real-time clock chip. Unlike the more common DS1307 or DS3231 (which use I2C), the DS1302 communicates via a 3-wire interface (CLK, DAT, RST). This makes it incredibly simple to wire up and frees your I2C pins for other sensors. virtuabotixrtc.h arduino library

void setup() Serial.begin(9600);

int currentHour = myRTC.hours;

delay(1000); // Update every second

else digitalWrite(ledPin, LOW); if (currentHour == 20 && myRTC.minutes == 0 && myRTC.seconds < 5) Serial.println("Evening – LED is OFF.");

delay(500);

void setup() Serial.begin(9600);

void setup() pinMode(ledPin, OUTPUT); Serial.begin(9600);

void loop() // Nothing here – this is a one‑time setup