Arduino Library !exclusive!: Virtuabotixrtch

void loop() // Get the current time and date int hours = rtch.getHours(); int minutes = rtch.getMinutes(); int seconds = rtch.getSeconds(); int day = rtch.getDay(); int month = rtch.getMonth(); int year = rtch.getYear();

You only need to set the time once (e.g., in setup() ). After uploading this once, the setDS1302Time line and re-upload so the clock doesn't reset every time the Arduino restarts.

The library is typically installed manually from GitHub as it is not always available in the standard Arduino Library Manager. Get the ZIP file from the official repository . virtuabotixrtch arduino library

| Feature | VirtuabotixRTC | RTClib (Adafruit) | | :--- | :--- | :--- | | | DS1302 (Primary) | DS1307, DS3231, PCF8523, etc. | | Communication Protocol | 3-Wire Serial (uses digital pins) | I2C (uses SDA/SCL pins) | | Complexity | Very low, beginner-friendly | Moderate | | Code Style | Direct variable access ( myRTC.hours ) | Object-oriented ( rtc.now().hour() ) | | Additional Features | Minimal, focused on core functions | Alarms (DS3231), temperature sensor, etc. | | External Resources | Relies on a few community-maintained sources | Actively maintained by Adafruit, extensive documentation |

Supports 24-hour time or 12-hour time with an AM/PM indicator. void loop() // Get the current time and

If you want, I can:

Sets the time on the DS1302 chip. Note: dayofweek (1=Sunday, 7=Saturday) is usually ignored by the DS1302 but required for compatibility. Get the ZIP file from the official repository

This library is the perfect choice if you are using a DS1302 module, are a beginner, or want the simplest possible code for a basic clock project. Its direct variable access makes it exceptionally easy to work with.

To use the library, you must first include the header and define the pins connected to your DS1302 module. Import a Code Library to Arduino : 6 Steps - Instructables

While not always listed due to its community-driven nature, it's always worth checking if the library has been indexed.

The library is a dedicated tool for interfacing Arduino microcontrollers with the DS1302 Real-Time Clock (RTC) module. It simplifies the process of setting, updating, and retrieving time data—including seconds, minutes, hours, days, months, and years—from the chip. Core Features