// Define the analog pin, the LM35's Vout pin is connected to
#define sensorPin A4
void setup() {
// Imitialize serial comunication
Serial.begin(9600);
// Use 1.1 V reference for ADC measurements
analogReference(INTERNAL);
}
void loop() {
// Get the voltage reading from the LM35
int reading = analogRead(sensorPin);
// Convert that reading into voltage
float voltage = reading * 1.1 / 1024.0;
// Convert the voltage into the temperature in Celsius
float temperatureC = voltage * 100;
//Print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println("\xC2\xB0C");
delay(1000); // wait a second between readings
}