2022-08-04 01:40 PM
Hi,
I'm usin the seed LoRa-e5 with the BME680.
I want send the output of the sensor through uart to the console. The thing is, that most of the output values are float.
I'm using the LoRaWAN_End_Node sample as base.
Regards,
Johannes
2022-08-04 10:57 PM
float is omitted by default because it drags in alot of additional code. In STM32CubeIDE Project Settings > C/C++ Build Settings > MCU Settings you may check the Use float checkbox(es).
hth
KnarfB
2022-08-05 11:48 PM
Hi,
that was not my question.I know how enable the float settings.
To precise my question:
I use APP_LOG respectively UTIL_ADV_TRACE_COND_FSend() to write to uart.
I dont know if it is possible to write float with APP_LOG. If yes what specifier I must use, if not whats fuction can I use ?
Johannes
2022-08-06 02:10 AM
UTIL_ADV_TRACE_COND_FSend is implemented in https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Utilities/trace/adv_trace/stm32_adv_trace.c and calls UTIL_ADV_TRACE_VSNPRINTF for formatting.
Your project defines that to tiny_vsnprintf_like, see https://github.com/STMicroelectronics/STM32CubeWL/blob/main/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node/Core/Inc/utilities_conf.h
You may change that definition to vnsprintf (stdio.h) and then use the usual format specifiers.
(not tested)
hth
KnarfB
2022-08-07 11:38 PM
Hi,
I've tested it and it works.
Thank you
2024-04-07 11:53 AM
Hi @JFlor.4
How do you got it to work?
I want to print some lines to serial but I can only print int variables.
Here's an example:
APP_LOG(TS_OFF, VLEVEL_L, "%d,%d,%d,%d,%d,", accumulator_voltage*10, accumulator_current*10, power*10, ((rightPlanetary_temperature+leftPlanetary_temperature)/2)*10, rightMotor_temperature*10);
How can I print float variables?
Tks,
2024-04-07 01:22 PM
https://community.st.com/t5/stm32cubeide-mcus/how-to-use-float-in-printf/td-p/323872