#include <LCD_I2C.h>
LCD_I2C lcd(0x27, 16, 2);
float celsius;
void setup()
{ lcd.begin();
lcd.backlight();
}
void loop()
{ lcd.setCursor(0,0); lcd.print(" Hello");
getTemp(); //NTC Temperature sensor
}
void getTemp()
{ const float BETA = 3950;
int analogValue = analogRead(A0);
//NTC Formula
celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
//LM35 Formula
//celsius = (analogValue / 1023) * 500;
lcd.setCursor(0,1); lcd.print(celsius);
}