#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#include <RTClib.h>
RTC_DS1307 rtc;
String mmonth [12]{ "January", "February", "March",
"April", "May", "June",
"July" , "August", "September",
"October", "November", "December"};
int day;
int month;
int year;
int hour;
int minute;
int second;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(2, INPUT);
pinMode(4, OUTPUT);
pinMode(5, INPUT);
lcd.init();
lcd.backlight();
rtc.begin();
}
void loop() {
DateTime now = rtc.now();
day = now.day();
month = now.month();
year = now.year();
hour = now.hour();
minute = now.minute();
second = now.second();
lcd.setCursor(0, 0);
// lcd.print("date = ");
lcd.print( day);lcd.print (" ");
lcd.print(mmonth[month]); lcd.print (" ");
lcd.print(year);
//
lcd.setCursor(5,1 );
// lcd.print("Time = ");
lcd.print(hour);lcd.print (":");
lcd.print(minute); lcd.print (":");
lcd.print(second);
}// End loop