I use the following code:
NRF_LOG_RAW_INFO("\t (%f %f %f)\r\n", fgx, fgy, fgz);
I get
(f f f)
What is missing here?
I use the following code:
NRF_LOG_RAW_INFO("\t (%f %f %f)\r\n", fgx, fgy, fgz);
I get
(f f f)
What is missing here?
Hi,
You need to use NRF_LOG_FLOAT_MARKER
and NRF_LOG_FLOAT()
to print floats, as described in the documentation:
NRF_LOG_INFO("My float number" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(f)))
Best regards,
Jørgen
It looks like this no longer works properly in the latest SDK (nRF5_SDK_13.0.0_04a0bfd.zip).
NRF_LOG_INFO("My float number: " NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(15.32f));
now gives the output
APP:INFO:My float number: 15.2d
It looks like the interpretation of %02d has changed, and that it now interprets %0 as an empty string and outputs a literal "2d".
It looks like this no longer works properly in the latest SDK (nRF5_SDK_13.0.0_04a0bfd.zip).
NRF_LOG_INFO("My float number: " NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(15.32f));
now gives the output
APP:INFO:My float number: 15.2d
It looks like the interpretation of %02d has changed, and that it now interprets %0 as an empty string and outputs a literal "2d".