const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int LED = 3; // should match the Beta Coefficient of the thermistor
int LED_T = 2; // should match the Beta Coefficient of the thermistor
int LED_E = 5; // should match the Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
pinMode(LED, OUTPUT);
pinMode(LED_T, OUTPUT);
pinMode(LED_E, 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(" ℃");
if (celsius > 70){
digitalWrite(LED,HIGH);
digitalWrite(LED_E,LOW);
digitalWrite(LED_T,LOW);
}else if(celsius > 0 &&celsius < 70 ){
digitalWrite(LED,LOW);
digitalWrite(LED_T,LOW);
digitalWrite(LED_E,HIGH);
}else if(celsius < 0){
digitalWrite(LED_T,HIGH);
digitalWrite(LED_E,LOW);
digitalWrite(LED,LOW);
}
// delay(1000);
}