I have an lcd and a Pcf8563 Real Time Clock. I have the following sketch which is used to set the time and date.
/* Demonstration of Rtc_Pcf8563 Clock on LCD.
*
* I used a Arduino mega 2560,
* SCL -21, SDA - 20,
*
* This sketch connects a lcd to display the clock output.
* written by
* Joe Robertson, jmr
* orbitalair@bellsouth.net
*/
#include <Wire.h>
#include <Rtc_Pcf8563.h>
/* add the lcd support */
#include <LiquidCrystal.h>
//init the real time clock
Rtc_Pcf8563 rtc;
/* initialize the library objects */
LiquidCrystal lcd(7,8,9,10,11,12);
void setup()
{
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
//clear out all the registers
rtc.initClock();
//set a time to start with.
//day, weekday, month, century, year
rtc.setDate(14, 6, 3, 0, 10);
//hr, min, sec
rtc.setTime(1, 15, 40);
}
void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
//lcd.print(rtc.formatTime(RTCC_TIME_HM));
lcd.print(rtc.formatTime());
lcd.setCursor(0, 1);
//lcd.print(rtc.formatDate(RTCC_DATE_ASIA));
lcd.print(rtc.formatDate());
delay(1000);
}
The sketch allows for the time and date to be set before the sketch is compliled. But I want to SET both using push buttons to change time and date variables.
The Libray for this "Rtc_Pcf8563.h", has the code for changing the time and date. So would the answer lie in the library. Do I cut and past the code from the libray into the sketch above .