Virtuabotixrtch Arduino Library

Virtuabotixrtch Arduino Library

Sets the time on the DS1302 chip.
Note: dayofweek (1=Sunday, 7=Saturday) is usually ignored by the DS1302 but required for compatibility.

If you have a DS1302 module (often the one with the vertical pins), this library offers a few distinct advantages:

#include <VirtuabotixRTC.h>

// Define pins: CLK, DAT, RST VirtuabotixRTC myRTC(6, 7, 8); virtuabotixrtch arduino library

void setup() Serial.begin(9600);

void loop() // Update time from RTC chip myRTC.updateTime(); Sets the time on the DS1302 chip

// Print time to Serial Monitor Serial.print("Time: "); Serial.print(myRTC.hours); Serial.print(":"); Serial.print(myRTC.minutes); Serial.print(":"); Serial.println(myRTC.seconds);

Serial.print("Date: "); Serial.print(myRTC.month); Serial.print("/"); Serial.print(myRTC.dayofmonth); Serial.print("/20"); Serial.println(myRTC.year); void loop() // Update time from RTC chip myRTC

Serial.println("--------"); delay(1000);