Virtuabotixrtc.h Arduino Library Link -

| DS1302 Module | Arduino Uno | | :--- | :--- | | VCC | 5V | | GND | GND | | CLK | Digital Pin 7 | | DAT | Digital Pin 6 | | RST | Digital Pin 5 |

If you need more features (alarms, DST helpers, broader chip support), consider libraries such as RTClib (Adafruit) or TimeLib, which provide richer functionality and wider device support. virtuabotixrtc.h arduino library

void setup() Serial.begin(9600); // Uncomment once to set time (Year offset from 2000: 25 = 2025) // myRTC.setDS1302Time(0, 30, 14, 3, 15, 4, 25); | DS1302 Module | Arduino Uno | |

: The library is older and may not be found in the official Arduino Library Manager by default; it often requires manual installation from GitHub repositories Hardware Accuracy broader chip support)

// UNCOMMENT THE NEXT LINE TO SET TIME, THEN COMMENT IT BACK AND RE-UPLOAD // myRTC.setDS1302Time(00, 30, 14, 4, 25, 10, 2023);

#include // Creation of the Real Time Clock Object (CLK, IO, CE) virtuabotixRTC myRTC(6, 7, 8); void setup() Serial.begin(9600); // Set the time: (seconds, minutes, hours, day of week, day of month, month, year) myRTC.setDS1302Time(00, 59, 23, 6, 10, 1, 2024); void loop() // Update internal variables myRTC.updateTime(); // Access elements directly Serial.print(myRTC.hours); Serial.print(":"); Serial.println(myRTC.minutes); delay(1000); Use code with caution. Copied to clipboard

void loop() Time t = myRTC.getTime(); Date d = myRTC.getDate(); Serial.print(d.day); Serial.print('/'); Serial.print(d.month); Serial.print('/'); Serial.print(d.year); Serial.print(' '); Serial.print(t.hour); Serial.print(':'); Serial.print(t.minute); Serial.print(':'); Serial.println(t.second); delay(1000);