const int lm35Pin = A0;
void setup() {
Serial.begin(9600);
pinMode(lm35Pin, INPUT);
}
void loop() {
int adcVal = analogRead(lm35Pin);
float milliVolt = adcVal * (5000.0 / 1024.0);
float tempC = milliVolt / 10;
float tempF = tempC * 9 / 5 + 32;
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.print("°C");
Serial.print(" ~ ");
Serial.print(tempF);
Serial.println("°F");
delay(1000);
}