#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
#include <RTClib.h>
RTC_DS1307 rtc;
DateTime waktu;
int jam,menit,detik,tahun,bulan,hari;
char temp[20], temp2[8];
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
lcd. init();
rtc.begin();
lcd.home();
lcd.print("halo dunia");
// put your setup code here, to run once:
//Serial.begin(115200);
//Serial.println("Hello, ESP32!");
}
void loop() {
waktu = rtc.now();
jam = waktu.hour();
menit = waktu.minute();
detik = waktu.second();
tahun = waktu.year();
bulan = waktu.month();
hari = waktu.day();
sprintf(temp,"%2d:%2d:%2d",jam,menit,detik);
lcd.setCursor(0,1);
lcd.print(temp);
sprintf(temp,"%4d/%2d/%2d",tahun,bulan,hari);
lcd.setCursor(0,2);
lcd.print(temp);
int analogValue = analogRead(36);
float celsius = 1 / (log(1 / (4095. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
dtostrf(celsius,6,2,temp2);
sprintf(temp,"suhu: %s c",temp2);
lcd.setCursor(0,3);
lcd.print(temp);
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}