Virtuabotixrtc.h | Arduino Library
delay(60000); // Wait 1 minute between readings
int tempReading = analogRead(tempPin); float voltage = tempReading * (5.0 / 1023.0); float temperatureC = voltage * 100.0; virtuabotixrtc.h arduino library
delay(500);
After running this sketch once, comment out the setDS1302Time line and re-upload a "read-only" sketch. Otherwise, you will reset the clock to the old time every time the Arduino boots. Step 4: Reading Time – Core Library Functions Once the RTC is set, the real fun begins. The virtuobabotixRTC object updates its internal variables when you call updateTime() . Here are the most useful functions. The Main Loop Example #include <virtuobabotixRTC.h> virtuobabotixRTC myRTC(7, 6, 5); delay(60000); // Wait 1 minute between readings int
Serial.print("Date (MM/DD/YYYY): "); Serial.println(myRTC.getDateStr()); // Returns "04/30/2026" Sleeping
else // Outside working hours: do nothing (or deep sleep) Serial.println("Outside logging hours. Sleeping...");