Virtuabotixrtc.h Arduino Library -
void loop() // This is the most important line. It reads the RTC's current time // into the library's variables. myRTC.updateTime();
delay(500);
// Set the time and date manually // Syntax: setDS1302Time(seconds, minutes, hours, dayOfMonth, month, dayOfWeek, year) // NOTE: dayOfWeek: Sunday=1, Monday=2 ... Saturday=7 virtuabotixrtc.h arduino library
Serial.print("Date (MM/DD/YYYY): "); Serial.println(myRTC.getDateStr()); // Returns "04/30/2026"
void setup() Serial.begin(9600);
int tempReading = analogRead(tempPin); float voltage = tempReading * (5.0 / 1023.0); float temperatureC = voltage * 100.0;
// Example: April 30, 2026, 14:30:00, Wednesday (dayOfWeek = 4) myRTC.setDS1302Time(00, 30, 14, 30, 4, 4, 26); void loop() // This is the most important line
// --- Different ways to display time ---