#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int TMP36Pin = A0;
LiquidCrystal_I2C lcd(0x20, 16, 2);
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.init();
lcd.backlight();
}
void loop() {
int rawValue = analogRead(TMP36Pin);
float voltage = rawValue * (5.0 / 1023.0);
float temper = (voltage - 0.5) * 100.0;
Serial.print("Temperature: ");
Serial.println(temper);
lcd.setCursor(0, 0);
lcd.print("Temperature: ");
lcd.setCursor(0, 1);
lcd.print(temper);
lcd.print(" C");
delay(1000);
}
Copyright ⓒ TECH79 All right reserved