#include <LiquidCrystal_I2C.h>
#include <math.h>


#define PIR_PIN 17
#define TEMP_PIN 34
#define LED_PIN 2
const float BETA = 3950;

LiquidCrystal_I2C lcd(0x27, 20, 4);


void setup() {
  Serial.begin(9600);
  pinMode(PIR_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  lcd.init();
  lcd.clear();
}

void loop() {
  int motionDetected = digitalRead(PIR_PIN);
  int analogValue = analogRead(TEMP_PIN);

  if (motionDetected == HIGH) {
    float temperature = 1 / (log(1 / (4095.0 / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
    lcd.setCursor(0, 0);
    lcd.print("Temp: ");
    lcd.print(temperature);
    lcd.print(" C");

    if (temperature < 10) {
      digitalWrite(LED_PIN, HIGH);
      lcd.setCursor(0, 1);
      lcd.print("LED On");
    } else {
      digitalWrite(LED_PIN, LOW);
      lcd.setCursor(0, 1);
      lcd.print("LED Off");
    }
  } else {
    digitalWrite(LED_PIN, LOW);
    lcd.clear();
  }

  delay(1000);
}
$abcdeabcde151015202530fghijfghij