Abhishek Chaudhary

Virtuabotixrtc.h Arduino — Library

Instead of hardcoding, you can set the time based on your computer's clock at compilation using __TIME__ and __DATE__ macros, but note this requires parsing strings—a more advanced technique.

void setup() Serial.begin(9600); SD.begin(chipSelect); virtuabotixrtc.h arduino library

:

#include <VirtuabotixRTC.h> VirtuabotixRTC myRTC(5, 6, 7); // CE, IO, CLK Instead of hardcoding, you can set the time

int lastSecond = 0; void loop() myRTC.updateTime(); if (myRTC.second != lastSecond) lastSecond = myRTC.second; // Print or process time only once per second Serial.println(myRTC.second); Instead of hardcoding

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.