Print a float number with rui_uart_send

Hi, i am working with RAK 4270.
I want to print a float number with the function rui_uart_send.
Is this way correct?
float humedad = 4400;
humedad = (-6.0f + 0.0019073486328125f * humedad);
rui_uart_send(RUI_UART2, &humedad, strlen(humedad));

Because when i did that way, the result that shows in the serial port is incorrect.

Thanks !

Hi @FacuBarrionuevo ,

Your code will not work. RUI API for uart sending is uint8_t.

Hi Carl,

I know, but then how would i print a float through the uart_2 ?

Since if I do it with RUI_LOG_PRINTF it will print by UART_1.

RUI_LOG_PRINTF will only work on UART_1. If you really need UART2, probably scale your payload by multiplying it to x10 or x100. Then do the post-processing somewhere to retrieve its original form.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.