Virtuabotixrtc.h Arduino - Library

#include <VirtuabotixRTC.h> VirtuabotixRTC myRTC(6, 7, 8);

int currentHour = myRTC.hours;

Serial.println("Time set on RTC.");

| DS1302 Pin | Arduino Pin | |------------|--------------| | VCC | 5V | | GND | GND | | CLK | 6 | | DAT | 7 | | RST | 8 | virtuabotixrtc.h arduino library

// Set the time (year, month, day, hour, minute, second, day-of-week) // Sunday = 1, Monday = 2, ..., Saturday = 7 // Example: March 15, 2025, 14:30:00, Saturday = 7 myRTC.setDS1302Time(25, 3, 15, 14, 30, 00, 7); #include &lt;VirtuabotixRTC

Open the Serial Monitor (9600 baud) and watch the live clock. This is where the RTC shines. Let’s turn an LED on at 8:00 AM and off at 8:00 PM. int currentHour = myRTC.hours