#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
}
void loop() {
int sensor = analogRead(A0);
/* Cam bien LM35
float voltage = sensor / 1023.0 * 5.0;
float temperature = voltage * 100.0;
Ket thuc cam bien LM35 */
// Cam bien gia lap
const float BETA = 3950;
float temperature = 1 / (log(1 / (1023. / sensor - 1)) / BETA + 1.0 / 298.15) - 273.15;
// Ket thuc cam bien gia lap */
lcd.setCursor(0,0);
lcd.print("Nhiet do:");
lcd.setCursor(0,1);
lcd.print(temperature);
lcd.print(" ");
lcd.print((char)223);
lcd.print("C");
delay(200);
}