int tempPin = A0; // LM35 sensor is connected to analog pin A0
float temperature; // variable to store temperature value
void setup() {
Serial.begin(9600); // Start the serial communication
}
void loop() {
int sensorValue = analogRead(tempPin); // Read the analog value from the sensor
temperature = sensorValue *0.696969; // Convert the analog value to temperature (10mV per degree C for LM35)
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C"); // Display temperature in Celsius
delay(1000); // Wait for 1 second before taking the next reading
}