#define LM35_PIN 36
void setup() {
Serial.begin(115200);
analogReadResolution(12);
analogSetPinAttenuation(LM35_PIN, ADC_11db);
}
void loop() {
int sum = 0;
for (int i = 0; i < 20; i++) {
sum += analogRead(LM35_PIN);
delay(2);
}
int adcVal = sum / 20;
float voltage = adcVal * (3.3 / 4095.0);
voltage += 0.02; // small offset
float tempC = voltage * 100.0 * 1.45; // CALIBRATION FIX
Serial.print("Temperature: ");
Serial.print(tempC, 1);
Serial.println(" °C");
delay(1000);
}