#include "DS1302.h"
// Define the pins for DS1302
#define DS1302_CE_PIN 4
#define DS1302_DAT_PIN 3
#define DS1302_CLK_PIN 2
// Create DS1302 object
DS1302 rtc(DS1302_CE_PIN, DS1302_DAT_PIN, DS1302_CLK_PIN);
void setup() {
// Start serial communication
Serial.begin(9600);
rtc.setTime(18, 10, 10, 7, 18, 9, 2020);
}
void loop() {
// Get current time
Time currentTime = rtc.getTime();
// Check if it's 8 AM
if (currentTime.hour == 8 && currentTime.min == 0 && currentTime.sec == 0) {
// Print "Good morning"
Serial.println("Good morning");
}
// Display current time
Serial.print("Current time: ");
Serial.print(currentTime.hour);
Serial.print(":");
Serial.print(currentTime.min);
Serial.print(":");
Serial.println(currentTime.sec);
// Wait for 1 second
delay(1000);
}