#include <PCD8544.h>
#include <DS1302.h>
// Init the DS1302
DS1302 rtc(2, 3, 4);
// Init the LCD
static PCD8544 lcd;
void setup()
{
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(true);
// Setup LCD characters
lcd.begin(84, 48);
// // The following lines can be commented out to use the values already stored in the DS1302
// rtc.setDOW(FRIDAY); // Set Day-of-Week
// rtc.setTime(20,45, 0); // Set the time (24hr format)
// rtc.setDate(13, 1, 2012); // Set the date
}
void loop()
{
// Display time on the upper line
lcd.setCursor(7, 0);
lcd.print(rtc.getTimeStr());
// Display Day-of-Week in the next line
lcd.setCursor(15, 8);
lcd.print(rtc.getDOWStr(FORMAT_LONG));
// Display date in the last line
lcd.setCursor(23, 16);
lcd.print(rtc.getDateStr());
// Wait one second before repeating :)
delay (1000);
}