#include <LiquidCrystal_I2C.h>
const int led=13;
const int bt=2;
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
// Init
pinMode(led, OUTPUT);
pinMode(bt, INPUT_PULLUP);
lcd.init();
lcd.backlight();
// Print something
}
void loop() { int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print("Temperature: ");
Serial.print(celsius);
Serial.println(" ℃");
delay(1000);
float mais=1;
int prog = digitalRead(bt);
for (mais=1; prog == HIGH;mais= mais +1);{}
float temp =1 + mais;
lcd.setCursor(1, 1);
lcd.print(celsius);
lcd.setCursor(2,2);
lcd.print(temp);
if (celsius < temp ){digitalWrite(led, LOW);};
if (celsius >temp){digitalWrite(led, HIGH);};
}