#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
#define Sensor 25
const float BETA = 3950;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello, ESP32!");
pinMode(Sensor, INPUT);
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
LCD.print("Zustand");
}
void loop() {
// put your main code here, to run repeatedly:
int Temperatur = analogRead(Sensor);
float celsius = 1 / (log(1 / (4095. / Temperatur - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.println(Temperatur);
LCD.setCursor(0, 1);
LCD.print(celsius);
delay(500); // this speeds up the simulation
}