2021-04-14 09:18 AM
2021-04-14 09:30 AM
Use HAL_UART_Transmit() casting a pointer to the variable or array to (uint8_t *) and describing the size of it.
Basic C coding
float myarray[8];
HAL_UART_Transmit(&hUart2, (uint8_t *)myarray, sizeof(myarray), SOMETIMEOUT);
HAL_UART_Transmit(&hUart2, (uint8_t *)&myarray[0], sizeof(myarray), SOMETIMEOUT);
These things are just collections of bytes, review Data Representation if you are unfamiliar with how computers hold data in memory or files.
2021-04-14 12:17 PM
I have to learn how to send data in all data types. eg: float, string, byte, uint8_t array. Can you suggest a resource to me
2021-04-14 12:25 PM
K&R ?
char string[] = "Hello\r\n";
HAL_UART_Transmit(&hUart2, (uint8_t *)string, strlen(string), SOMETIMEOUT);
float flt = 123.45f;
HAL_UART_Transmit(&hUart2, (uint8_t *)&flt, sizeof(flt), SOMETIMEOUT);
2021-04-14 02:07 PM
Float as a string
char string[16];
float flt = 123.45f;
HAL_UART_Transmit(&hUart2, (uint8_t *)string, sprintf(string,"%lf",flt), SOMETIMEOUT);