I can't find any documentation on how to use the RTC.h Library.
I am trying to use the RTC Library Example that is included when M-Duino board family is added.
This is my code:
// RTC library example
// by Industrial Shields
#include <RTC.h>
byte seconds = 0;
byte minutes = 50;
byte hours = 12;
/* Change these values to set the current initial date */
byte day = 4;
byte month = 8;
byte year = 20;
////////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600L);
RTC.setHour(hours);
RTC.setMinute(minutes);
RTC.setSecond(seconds);
// Set the date
RTC.setMonthDay(day);
RTC.setMonth(month);
RTC.setYear(year);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void loop() {
// if (!RTC.read()) {
// Serial.println("Read date error: is time set?");
// } else {
RTC.read();
Serial.print("Time: ");
Serial.print(RTC.getYear());
Serial.print("-");
Serial.print(RTC.getMonth());
Serial.print("-");
Serial.print(RTC.getMonthDay());
Serial.print(" ");
Serial.print(RTC.getHour());
Serial.print(":");
Serial.print(RTC.getMinute());
Serial.print(":");
Serial.print(RTC.getSecond());
Serial.print(" (");
Serial.print(RTC.getTime());
Serial.println(")");
delay(1000);
}