I've been trying to make a small clock using LCD That I believe has been wired and breadboarded correctly. I used this code, but I get an error that says, "DateTime was not declared in this scope".
My Code:
#include <LiquidCrystal.h>
#include <DateTime.h>
// simple sketch to display a digital clock on an LCD
// see the LiquidCrystal documentation for more info on this
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
void setup(){
DateTime.sync(1230768000); // set jan 1 2009 as the default time
}
void loop(){
if(DateTime.available()) {
unsigned long prevtime = DateTime.now();
while( prevtime == DateTime.now() ) // wait for the second to rollover
;
DateTime.available(); //refresh the Date and time properties
digitalClockDisplay( ); // update digital clock
}
}
void printDigits(byte digits){
// utility function for digital clock display: prints preceding colon and leading 0
lcd.print(":");
if(digits < 10)
lcd.print('0');
lcd.print(digits,DEC);
}
void digitalClockDisplay(){
lcd.home();
// digital clock display of current time
lcd.print(DateTime.Hour,DEC);
printDigits(DateTime.Minute);
printDigits(DateTime.Second);
}