#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);
#include "DHT.h"

#define DHTPIN 2
#include "RTClib.h"

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};


#define DHTTYPE DHT22  
DHT dht(DHTPIN, DHTTYPE);

const float BETA = 3950; 

void setup() {
  
  

  dht.begin();
 

}

void loop() {
 if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    abort();
  }
 

 lcd.init();
 lcd.backlight();
 
int analogValue = analogRead(A3);
  float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
  lcd.setCursor(0,0);
  lcd.print("Temperature: ");
  lcd.print(celsius);
  lcd.print(" C");
  


  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)


  // Check if any reads failed and exit early (to try again).
  if (isnan(h)) {
    lcd.print(F("Failed to read from DHT sensor!"));
    return;
  }


  lcd.setCursor(0,1);
  lcd.print(F("Humidity: "));
  lcd.print(h);

 DateTime now = rtc.now();
lcd.setCursor(0,2);
lcd.print("Current time: ");
 lcd.print(now.hour(), DEC);
  lcd.print(':');
  lcd.print(now.minute(), DEC);
 























}
GND5VSDASCLSQWRTCDS1307+