#include <Servo.h>
Servo servo1;
void setup() {
Serial.begin(115200);
pinMode(A0, INPUT); // put your setup code here, to run once:
pinMode(3, OUTPUT);
pinMode(7, INPUT_PULLUP);
servo1.attach(3);
}
void loop() {
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;// put your main code here, to run repeatedly:
int ser = map(celsius, -24, 80, 0, 90);
if (digitalRead(7) != HIGH) {
ser = 0;
};
servo1.write(ser);
Serial.println("Temperature:" + String(celsius) + String(":corner motor ") + String(ser));
delay(700);
}