Quote:
Originally Posted by Mikesolar
It seems to ignore the added code and continues to post in ohms.
|
What it 'posts' is the value passed to the function
Serial.println. That function name indicates you are utilizing the
serial port to
print a
line.
The value you are passing in your new code is the same passed in the original:
Code:
Serial.print("Thermistor resistance ");
Serial.println(reading);
If you want to print something else you need to specify such, e.g.
Code:
float logcubed = log(reading);
logcubed = logcubed * logcubed * logcubed;
float kelvin = 1.0 / (-7.5e-4 + 6.23e-4 * log(reading) - 1.73e-6 * (logcubed));
float celsius = kelvin - 273.15;
Serial.println(celsius);
And note the correct value is placed into the variable
celsius before you pass it to the
Serial.println function to be displayed.
Also, you should paste the full error message you are receiving with the other code you are trying to use. Compiler errors typically indicate a line number at the beginning to help pinpoint the source of the mistake.
Variable scope relates to which portions of your code may access a given variable. This scope is determined by where the variable is defined. For example, function-local scope is variables defined within a function (within the brackets { } encapsulating the function definition) whereas module/file-level scope is variables defined outside of any function, which can be accessed within any function.
I could go on and on but it sounds like you're just trying to get your feet wet and I don't want to drown you. Also, take everything I say with a grain of salt. I've never coded for the Arduino, but I am familiar with C/C++, and like to make assumptions.