I am using this code I found in this forum:
void printDouble( double val, unsigned int precision){
// prints val with number of decimal places determine by precision
// NOTE: precision is 1 followed by the number of zeros for the desired number of decimial places
// example: printDouble( 3.1415, 100); // prints 3.14 (two decimal places)
Serial.print (int(val)); //prints the int part
Serial.print("."); // print the decimal point
unsigned int frac;
if(val >= 0)
frac = (val - int(val)) * precision;
else
frac = (int(val)- val ) * precision;
int frac1 = frac;
while( frac1 /= 10 )
precision /= 10;
precision /= 10;
while( precision /= 10)
Serial.print("0");
Serial.println(frac,DEC) ;
}
But I get this error on my program:
test.ino:25: error: cannot convert 'float (*)()' to 'double' for argument '1' to 'void printDouble(double, unsigned int)'
printDouble(read_temperature,10000000);
How can I fix this?