This error means the Arduino IDE cannot locate the library. Ensure you have completed the installation steps correctly and that you have included the library at the top of your sketch with #include <virtuabotixRTC.h> .
Now your RTC will keep ticking thanks to its battery backup!
VirtuabotixRTCH rtc;
#include // Creation of the Real Time Clock Object (SCLK, DAT, RST) virtuabotixRTC myRTC(6, 7, 8); void setup() Serial.begin(9600); // Set time format: seconds, minutes, hours, day of week, day of month, month, year // Day of week: Sunday = 1, Monday = 2, etc. // Run this ONCE to set the clock, then comment it out and re-upload. myRTC.setDS1302Time(00, 30, 15, 2, 21, 4, 2026); void loop() // Always update the time before reading elements myRTC.updateTime(); // Access individual elements Serial.print("Current Time: "); Serial.print(myRTC.hours); Serial.print(":"); Serial.print(myRTC.minutes); Serial.print(":"); Serial.println(myRTC.seconds); delay(1000); Use code with caution. Copied to clipboard IoT cloud rtc problem - Arduino Forum virtuabotixrtch arduino library
| Library | RTC Chip | Advantages | |---------|----------|------------| | (Adafruit) | DS1307, DS3231, PCF8523 | Actively maintained, alarms, temperature | | DS1302 (by Matthias Hertel) | DS1302 | More robust, works on ESP32 | | RtcDS1302 (by Makuna) | DS1302 | Efficient, supports all MCUs, burst mode | | TinyRTC | DS1307 | For older TinyRTC modules |
Performance will be slower but functional.
: Typically uses a 3-wire serial interface (SCLK, I/O, and CE/Reset) rather than standard I2C. Instructables Key Library Methods virtuabotixRTC(SCLK, IO, CE) : Constructor to define the pins connected to the DS1302. This error means the Arduino IDE cannot locate the library
// myRTC.setDS1302Time(00, 30, 14, 5, 13, 10, 2023); // Example: 14:30:00, Friday, Oct 13, 2023
Note: For heavy timestamp math, consider switching to RTClib.
If you are building a battery-powered logger, you cannot call updateTime() every second. Instead, wake up the microcontroller, update once, read the time, log data, and go back to sleep. The RTC keeps running on its own battery. VirtuabotixRTCH rtc; #include // Creation of the Real
: Unlike some libraries that require complex structures, you can access time components directly (e.g., myRTC.seconds myRTC.minutes ) after calling updateTime() Getting Started
The VirtuabotixRTCH library opens up a world of possibilities for Arduino projects. Here are a few examples to get you started: