#include <LiquidCrystal.h>
const float BETA = 3950;
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Temperature:");
}
void loop() {
// put your main code here, to run repeatedly:
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
if (celsius > 50) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
lcd.setCursor(0, 1);
String text = String(celsius) + "\xDF\C";
lcd.print(text);
for (int i = 0; i < 16 - text.length(); i++) {
lcd.print(" ");
}
delay(250);
}