#include <Servo.h>
#include <stdio.h>
#define SENSOR_TEMP A0
#define PIN_SERVO 3
Servo servomotor;
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
servomotor.attach(PIN_SERVO);
servomotor.write(90);
}
void loop() {
servomotor.write(90);
int analogValue = analogRead(SENSOR_TEMP);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.println(celsius);
if(celsius>=33){
servomotor.write(180);
}
if(celsius<0){
servomotor.write(0);
}
delay(1000);
}