Using Double and Float Printing in V18

Hi Everyone, I've seen in the release notes for v18 that the serial_print and serial_println commands should be able to send procession data out. I've just been excistingly looking for this function and how to use it, but in v18 my code still sends out 2 dp and i cant find any info on how to change this. Could someone point me in the direct direction please?


From "print.cpp":

void Print::println(double n, int digits)
void Print::print(double n, int digits)

Hi Thanks for the reply,
I’m using the code


If this was a float, how should i be coding it?
in Print.cpp i found

printFloat(n, digits);

does that mean i need to use:-

Serial.printFloat(inByte, 6)

To print out a float with 6dp onto the serial port?



The variable being printed needs to be a float or double. You use Serial.print.

double pi = 3.14159;
Serial.print(pi, 5);

Great thanks for that! May i just thank everyone who worked on that function!! It has made my life so much easier! (I dont have to put in extra routines to cope with floats!)