Home › Forums › Mayfly Data Logger › Printing floats with MS_DBG()
- This topic has 2 replies, 2 voices, and was last updated 2021-02-08 at 5:20 PM by
Matt Barney.
Viewing 2 reply threads
-
AuthorPosts
-
-
2021-02-08 at 3:29 PM #15118How can I specify higher floating-point precision when using MS_DBG()? For example:12float myFloat = 0.0001875;MS_DBG(myFloat);
prints:
1How can I specify higher floating-point precision when using MS_DBG()? For example:12float myFloat = 0.0001875;MS_DBG(myFloat);prints:
10.00 -
2021-02-08 at 4:39 PM #15119The Arduino print function defaults to two decimal places for a float. Normally, if you were usingThe Arduino print function defaults to two decimal places for a float. Normally, if you were using
Serial.print(float)
you could control the decimal places withSerial.print(float, decimalPlaces)
. But because of the way the MS_DBG macro is written, that won’t work. You’ll have to create a String from the number and then MS_DBG that:MS_DBG(String(float, decimalPlaces));
2021-02-08 at 5:20 PM #15120Ah, perfect – thanks Sara!
AuthorPostsViewing 2 reply threads- You must be logged in to reply to this topic.
-