|
#include <RTC.h>
RTC rtc;
void setup()
{
Serial.begin(9600);
rtc.begin();
rtc.setDateTime(2016, 9, 22, 23, 20, 50, RTC_WEEK_SATURDAY);
}
void loop()
{
int year, mon, day, hour, min, sec, week;
rtc.getDateTime(year, mon, day, hour, min, sec, week);
Serial.print(year, DEC);Serial.print("/");
Serial.print(mon, DEC); Serial.print("/");
Serial.print(day, DEC); Serial.print(" ");
Serial.print(hour, DEC); Serial.print(":");
Serial.print(min, DEC); Serial.print(":");
Serial.println(sec, DEC);
delay(500);
} |
|