// Define analog pin
const int tempPin = A0; // 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 / (1023.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
}