#define sensorPin A0
void setup() {
// Begin serial communication at a baud rate of 9600:
Serial.begin(9600);
pinMode(9, INPUT);
}
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;
Serial.println(celsius);
// // Get a reading from the temperature sensor:
// int reading = analogRead(sensorPin);
// // Convert the reading into voltage:
// float voltage = reading * (5000 / 1024.0);
// // Convert the voltage into the temperature in Celsius:
// float temperature = (voltage - 500) / 100;
// // Print the temperature in the Serial Monitor:
// Serial.print(temperature);
// Serial.print(" \xC2\xB0"); // shows degree symbol
// Serial.println("C");
delay(1000); // wait a second between readings
}