Need help understanding thermisor use

Hi Guys I’m attempting to learn about using a thermistor to measure temperature for a project I’m working on, and for the most part I get it. I’m following along on this article: https://playground.arduino.cc/ComponentLib/Thermistor2

The simple version to be specific, What I’m having trouble with is this line:

Serial.println(int(Thermistor(analogRead(0))));  // display Fahrenheit

Can someone please break this line down and explain it to me? I don’t understand why analogRead is in there, I’d expect it to be somewhere else.

here is the complete code in case you need it:

#include <math.h>

double Thermistor(int RawADC) {
 double Temp;
 Temp = log(10000.0*((1024.0/RawADC-1))); 
//         =log(10000.0/(1024.0/RawADC-1)) // for pull-up configuration
 Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
 Temp = Temp - 273.15;            // Convert Kelvin to Celcius
 Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
 return Temp;
}

void setup() {
 Serial.begin(115200);
}

void loop() {
 Serial.println(int(Thermistor(analogRead(0))));  // display Fahrenheit
 delay(100);
}
Serial.println(int(Thermistor(analogRead(0))));

The analogRead() returns a value between 0 and 1023 depending on the voltage read The value is passed to the Thermistor() function which returns a value representing the temperature in degrees Fahrenheit. The value is returned as type double The value is converted to an int The int value is printed

Thank you so much,I have few new questions though thanks to your explanation. Where do you specify the read pin? is that the 0 after anologRead? shouldn't it be A0? what happens if I also want to use digital pin 0 to control something else?

Thank you again for your explanation.

l1t7l3ph0o7: Thank you so much,I have few new questions though thanks to your explanation. Where do you specify the read pin? is that the 0 after anologRead? shouldn't it be A0? what happens if I also want to use digital pin 0 to control something else?

Thank you again for your explanation.

When you use analogRead, it is smart enough to know that 0 means A0 since analogRead can't work on digital 0. Still, you are correct. For clarity sake you should probably use A0 there.

also want to use digital pin 0 to control something else?

Just for your information: Digital pin 0 is the hardware serial RX input on most Arduinos. So it is not a good idea to use pin 0 for anything else.

14=a0 15=a1 16=a2 17=a3 18=a4 19=a5