const int analogPin = 34; // GPIO 34 for analog input
const float nominalResistance = 10000; // 10k Ohm nominal resistance at 25 degrees C
const float nominalTemperature = 25; // nominal temperature value (in Celsius)
const float bCoefficient = 3950; // Beta coefficient of the thermistor (usually 3000-4000)
const int seriesResistor = 10000; // 10k Ohm series resistor
void setup() {
Serial.begin(115200);
}
void loop() {
long T1=millis();
int analogValue = analogRead(analogPin);
float resistance = seriesResistor / (4095.0 / analogValue - 1);
float temperatureK = 1.0 / (1.0 / (nominalTemperature + 273.15) + 1.0 / bCoefficient * log(resistance / nominalResistance));
float temperatureC = temperatureK - 273.15;
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" °C");
long T1_exe=millis()-T1;
Serial.print("T1exe = ");
Serial.println(T1_exe);
delay(1000);
}