#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
//temperature-sensor
const float BETA = 3950;
void setup() {
//temperature-sensor
Serial.begin(9600);
//LCD
lcd.init();
lcd.backlight();
}
void loop() {
//temperature-sensor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
//LCD
lcd.setCursor(12, 0);
lcd.print(celsius);
int second = millis()/1000;
if(second/12%2>0){
lcd.scrollDisplayRight();
}else{
lcd.scrollDisplayLeft();
}
delay(1000);
}