// Define analog pin
const int tempPin = 34; // LM35 output connected to A0
void setup() {
Serial.begin(9600); // Start serial communication
}
void loop() {
int analogValue = analogRead(tempPin);
Serial.print("TnalogValue: ");
Serial.print(analogValue);
int celsius =1 / (log(1 / (4096.0 / analogValue - 1)) / 3950.0 + 1.0 / 298.15)- 273.15;
// Display result
Serial.print("Temperature: ");
Serial.print(celsius);
Serial.println(" °C");
delay(1000); // Wait 1 second before next reading
}
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;