#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const int component_led1 = 13;
float criticalTemp = 75;
float currentTemp;
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
lcd.begin(16, 2);
lcd.print("Hello World!");
Serial.begin(9600);
pinMode(component_led1, OUTPUT);
}
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);
if (celsius > criticalTemp){
digitalWrite(component_led1, HIGH);
}
else {
digitalWrite(component_led1, LOW);
}
}