// Click on the temp sensor module to open up a slider where you can control the temp.
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
const int TARGET = 30;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(12, OUTPUT);
Serial.begin(9600);
}
// the loop function runs over and over again forever
void loop() {
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
if(celsius < TARGET){
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
} else {
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
}
Serial.print("Temperature: ");
Serial.print(celsius);
Serial.println(" ℃");
delay((1000));
}