Virtuabotixrtch Arduino Library [updated] Here
// 4. Access the individual time components and print them to the Serial Monitor Serial.print("Current Date / Time: "); Serial.print(myRTC.dayofmonth); Serial.print("/"); Serial.print(myRTC.month); Serial.print("/"); Serial.print(myRTC.year); Serial.print(" "); Serial.print(myRTC.hours); Serial.print(":"); Serial.print(myRTC.minutes); Serial.print(":"); Serial.println(myRTC.seconds);
: Add #include at the top of your sketch. Hardware Wiring virtuabotixrtch arduino library
You can easily set and pull individual elements like seconds, minutes, hours, day of the week, and even the year. Lightweight: day of the week
Allows the use of any digital pins for CLK, DATA, and RST. and RST. For the DS3231
For the DS3231, the library exposes alarm functions that many other libraries bury:
Use setDS1302Time() in your setup() function. Upload this once to set the time, then comment it out and re-upload so your clock doesn't reset every time the Arduino restarts.