Virtuabotixrtc.h Arduino Library -

A Complete Guide to the virtuabotixRTC Arduino Library The library is a specialized software tool for Arduino. It lets you control Real-Time Clock (RTC) modules. It is most commonly used with the DS1302 clock chip.

void setup() Serial.begin(9600); // myRTC.setDS1302Time(...) // The time has already been set once.

Connecting your RTC module to an Arduino board requires five connections. You can use almost any digital pins on your Arduino for the data lines. RTC Module Pin Arduino Pin (Example) Description 5V or 3.3V Power supply GND Ground reference CLK (SCLK) Digital Pin 6 Serial Clock DAT (I/O) Digital Pin 7 Serial Data RST (CE) Digital Pin 8 Reset / Chip Enable 💻 Code Architecture virtuabotixrtc.h arduino library

You only need to set the time to program the chip. Once programmed, you should comment this line out and re-upload the sketch so the clock does not reset every time the Arduino restarts.

delay(500);

Now that you understand the basics, let's look at three practical applications.

// Set the time to: 15:30:00 on Friday, May 4th, 2026 // Parameters: sec, min, hour, dayOfWeek, dayOfMonth, month, year // Note: dayOfWeek: 1=Sun, 2=Mon, 3=Tue, 4=Wed, 5=Thu, 6=Fri, 7=Sat myRTC.setDS1302Time(0, 30, 15, 6, 4, 5, 2026); A Complete Guide to the virtuabotixRTC Arduino Library

The library defines a single class, VirtuabotixRTC , whose constructor requires three pins:

Наверх