: Allows setting the initial time and updating it continuously. Data Access
Once installed and wired, using the library involves creating an instance and calling its methods. 1. Library Initialization
Custom format: "DD-MM-YY" , "MM/DD/YYYY" , etc.
Specifically optimized to handle the 3-wire serial interface of the DS1302.
: Maintains data for day of the week, day of the month, month, and year.
// Set current time: seconds, minutes, hours, day of week, day of month, month, year // myRTC.setDS1302Time(00, 30, 10, 2, 14, 4, 2026); loop() { myRTC.updateTime(); Serial.print( "Current Time: " ); Serial.print(myRTC.hours); Serial.print( ); Serial.print(myRTC.minutes); Serial.print( ); Serial.println(myRTC.seconds); delay( Use code with caution. Copied to clipboard or a code for a custom alarm system using this library?
A common issue beginners face when using this library is seeing their clock every time the Arduino loses power or is reset via the button.
Library not installed correctly. Fix: Reinstall via Library Manager. Restart Arduino IDE.
#include <VirtuabotixRTC.h>
// Define the RTC module pins const int rtcClk = 2; const int rtcData = 3;
The upgraded, premium choice. It features a built-in temperature-compensated crystal oscillator (TCXO), making it highly accurate even in fluctuating temperatures.
| RTC Module Pin | Arduino Uno/Nano | Arduino Mega 2560 | ESP8266 (NodeMCU) | | :------------ | :--------------- | :---------------- | :---------------- | | | 5V | 5V | 3.3V | | GND | GND | GND | GND | | SCL | A5 | 21 | D1 (GPIO5) | | SDA | A4 | 20 | D2 (GPIO4) |
: Allows setting the initial time and updating it continuously. Data Access
Once installed and wired, using the library involves creating an instance and calling its methods. 1. Library Initialization
Custom format: "DD-MM-YY" , "MM/DD/YYYY" , etc.
Specifically optimized to handle the 3-wire serial interface of the DS1302. virtuabotixrtch arduino library
: Maintains data for day of the week, day of the month, month, and year.
// Set current time: seconds, minutes, hours, day of week, day of month, month, year // myRTC.setDS1302Time(00, 30, 10, 2, 14, 4, 2026); loop() { myRTC.updateTime(); Serial.print( "Current Time: " ); Serial.print(myRTC.hours); Serial.print( ); Serial.print(myRTC.minutes); Serial.print( ); Serial.println(myRTC.seconds); delay( Use code with caution. Copied to clipboard or a code for a custom alarm system using this library?
A common issue beginners face when using this library is seeing their clock every time the Arduino loses power or is reset via the button. : Allows setting the initial time and updating
Library not installed correctly. Fix: Reinstall via Library Manager. Restart Arduino IDE.
#include <VirtuabotixRTC.h>
// Define the RTC module pins const int rtcClk = 2; const int rtcData = 3; // Set current time: seconds, minutes, hours, day
The upgraded, premium choice. It features a built-in temperature-compensated crystal oscillator (TCXO), making it highly accurate even in fluctuating temperatures.
| RTC Module Pin | Arduino Uno/Nano | Arduino Mega 2560 | ESP8266 (NodeMCU) | | :------------ | :--------------- | :---------------- | :---------------- | | | 5V | 5V | 3.3V | | GND | GND | GND | GND | | SCL | A5 | 21 | D1 (GPIO5) | | SDA | A4 | 20 | D2 (GPIO4) |