int SENT = A0;
int RED = 2;
int BLUE = 4;
const float BETA = 3950;
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(4, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int ValueS = analogRead(SENT);
float celsius = 1 / (log(1 / (1023. / ValueS - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print(celsius);
Serial.println("Cº");
if(celsius > 25){
digitalWrite(2 , HIGH);
digitalWrite(4 , LOW);
}else if(celsius < 16){
digitalWrite(2 , LOW);
digitalWrite(4 , HIGH);
}else{
digitalWrite(2 , LOW);
digitalWrite(4 , LOW);
}
}