int SENSOR;
float TEMPERATURA;
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
void setup() {
Serial.begin(9600);
}
void loop() {
SENSOR = analogRead(A0);
//El siguiente código es para el sensor LM-35
/*
Serial.print(SENSOR);
Serial.print(" - ");
TEMPERATURA = ((SENSOR * 5000.0) / 1023) / 10;
Serial.println(TEMPERATURA, 1); //Número de posiciones decimales (1)
delay(1000);
*/
//El siguiente código está modificado para funcionar con el sensor simulado
TEMPERATURA = 1 / (log(1 / (1023. / SENSOR - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.print(SENSOR);
Serial.print(" - ");
Serial.println(TEMPERATURA, 1); //Número de posiciones decimales (1)
delay(100);
}