#include <math.h>
int tempPin = 26;
void setup() {
Serial1.begin(115200);
delay(1000);
Serial1.println("NTC Module System Started");
}
void loop() {
int analogValue = analogRead(tempPin);
const float BETA = 3950;
float temperature = 1 / (log(4095.0 / (4095.0 - analogValue) - 1) / BETA + 1.0 / 298.15) - 273.15;
if(temperature>68.53){
temperature=temperature-53.89;
}else if (temperature > 61.11){
temperature=temperature-54.53;
}else if (temperature > 54.84){
temperature=temperature-76.84;
}else{
temperature=temperature-78.5;
}
Serial1.print("Temperature: ");
Serial1.print(temperature);
Serial1.println(" °C");
if (temperature > 35) {
Serial1.println(" High Temperature");
} else if (temperature > 25) {
Serial1.println(" Normal Temperature");
} else {
Serial1.println(" Low Temperature");
}
Serial1.println("------------------------");
delay(1000);
}