int t = 0;
int sensor = A0;
float temp;
float tempf;
float tempk;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 16);
void setup() {
pinMode(sensor, INPUT);
lcd.begin();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" ARDUINO ");
lcd.setCursor(0, 1);
lcd.print("TEMPRETURE METER");
delay(2000);
Serial.begin(9600);
}
void loop() {
delay(2000);
t = t + 2;
temp = analogRead(sensor);
tempf = (temp * 5.0) / 10.0 * 1.8 + 32.0;
tempk = tempf + 459.67;
Serial.println("_______");
Serial.println("Temperature Logger");
Serial.print("Time in Seconds= ");
Serial.println(t);
Serial.print("Temp in deg Fahrenheit = ");
Serial.println(tempf);
Serial.print("Temp in deg Kelvin = ");
Serial.println(tempk);
lcd.setCursor(0, 0);
lcd.print("Temp in F = ");
lcd.println(tempf);
lcd.setCursor(0, 1);
lcd.print("Temp in K = ");
lcd.println(tempk);
}