Temperatur sensor

We're working on a project and we can't found the problem. We want measure the temperatur with a temperature sensor. Could you control the code please??

#include <math.h>
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + ( 0.000234125 + (0.0000000876741 * Temp * Temp ))*
Temp );
Temp = Temp - 273.15;
return Temp;
}
void setup(){
Serial.begin(9600);
}
void loop()
{ Serial.print(Thermister(analogRead(9600)));
Serial.printIn(9600);
delay(1000); }

WINUS:
We're working on a project and we can't found the problem. We want measure the temperatur with a temperature sensor. Could you control the code please??

#include <math.h>
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + ( 0.000234125 + (0.0000000876741 * Temp * Temp ))*
Temp );
Temp = Temp - 273.15;
return Temp;
}
void setup(){
Serial.begin(9600);
}
void loop()
{ Serial.print(Thermister(analogRead(9600)));
Serial.printIn(9600);
delay(1000); }

Serial.printIn(9600); ????

vffgaston:
Serial.printIn(9600); ????

We want to select te temperatur on our PC.
We are beginners with arduino and have no idea what we do.
Can you tell us how does the serial print works?

You need to define what analog pin the temp sensor is connected to and make it INPUT. Then you need to read from that pin NOT analogRead(9600). The analog pin will definitely not be 9600.

Most Arduinos will not do math with anywhere near 14 digits of precision so your calculations may also be a problem.

Also it should be Serial.println - the character before the n is a small L not a capital I.

Steve

I expect a cut n paste job here ... the code before setup is not used in your program .

I would go back to basics try the examples - analog inputs, coms, variable types and so on

So... this temperature sensor, is a thermistor? That's what the code suggest, you didn't specify.

For regular Arduinos a double is an alias of float. You don't get more than 6-7 digits of precision.

Your formulas don't resemble any that I know for thermistors. See e.g. this Adafruit tutorial on how to deal with these things.

slipstick:
Most Arduinos will not do math with anywhere near 14 digits of precision so your calculations may also be a problem.

No problem here. A number like 0.0000000876741 has just 6 relevant digits. A float stores it as 8.76741E-8. A number such as 0.001129148 (1.129148E-3) is more of an issue, the last digit may get lost.