#include <DS3231.h>
// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);
void setup()
{
// Setup Serial connection
Serial.begin(115200);
// Uncomment the next line if you are using an Arduino Leonardo
//while (!Serial) {}
// Initialize the rtc object
rtc.begin();
// The following lines can be uncommented to set the date and time
// rtc.setDOW(SATURDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(17,8,00); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(30,5,2020); // Set the date to January 1st, 2014
}
void loop()
{
int aa=13;
if (rtc.getTimeStr()=="17:10:00")
{
digitalWrite(13,HIGH);
delay(100);
}
// 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);
}
|