// Define the VirtuabotixRTCH module pins const int rtchPin = 5; const int rtclPin = 4;
// Print the current time and date Serial.print("Current Time: "); Serial.print(hours); Serial.print(":"); Serial.print(minutes); Serial.print(":"); Serial.println(seconds); Serial.print("Current Date: "); Serial.print(month); Serial.print("/"); Serial.print(day); Serial.print("/"); Serial.println(year);
delay(1000); }
#include <VirtuabotixRTCH.h>
Here is an example code that demonstrates how to use the VirtuabotixRTCH library with Arduino:
// Create an instance of the VirtuabotixRTCH class VirtuabotixRTCH rtch(rtchPin, rtclPin);
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();