#define tempPin 26
#define ledPin 33
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(tempPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int analogValue = analogRead(tempPin);
float celsius = 1 / (log(1 / (4095. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print("analogValue :");
Serial.println(analogValue);
Serial.print("celsius :");
Serial.println(celsius);
if(celsius>50)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
delay(100);
}