نقل قول:
#include <DS1307.h>
DS1307 rtc(SDA, SCL);
void setup()
{
Serial.begin(115200);
// Initialize the rtc object
rtc.begin();
// Set the clock to run-mode
rtc.halt(false);
// The following lines can be uncommented to set the time
//rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(1, 1, 2016); // Set the date to October 3th, 2010
}
void loop()
{
// Send Day-of-Week
Serial.print(rtc.getDOWStr());
Serial.print(" ");
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
// Wait one second before repeating :)
delay (1000);
}