# Help with an Arduino Sketch

Please guys i’ve an NTC and i found this sketch it works fine for me i only want to know the meaning of line of it
that is the sketch :

``````#include <math.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

double Temp=0;
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celcius

return Temp;
}

void setup() {

lcd.begin(16,2);
lcd.clear();

Serial.begin(115200);

Serial.begin(9600);

}

void loop() {

lcd.print(" degress C");

delay(100);

lcd.clear();

}
``````

The line that i can not understand is this one

``````Temp = log(((10240000/RawADC) - 10000));
``````

The Raw ADC numbers will be between 0 (representing zero volts on the analog pin) and 1023 (representing 5V). The voltage produced by the NTC circuit obviously has some logarithmic relationship to the temperature in degrees, hence the log function used in the conversion equation.

didyi: The line that i can not understand is this one

``````Temp = log(((10240000/RawADC) - 10000));
``````

That's the calculation of the resistance that the NTC currently has (while using a 10000 Ohm divider resistor).

So actually it's something like:

``````resistance = log(((10240000/RawADC) - 10000)); // NTC resistance in Ohm
``````

But it looks like the programmer wanted to save RAM during programming and therefore he did not want to declare an extra variable 'resistance' and instead used the declared variable 'Temp', which is what he finally wants. But in the line he just calculates the actual 'resistance'.