Question
Friends, my goal is to send a float number and a string with uart and read it from the live expressions section. But the number and the text are intertwined. What should I do?
HAL_UART_Receive_IT(&huart2, rx_buffer, 10);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Transmit(&huart2, (uint8_t*)tx_buffer, strlen(tx_buffer) ,HAL_MAX_DELAY );
HAL_UART_Transmit(&huart2, (uint8_t*)(value),strlen(value),100);
sprintf(value, "%f",x);
}
/* USER CODE END 3 */
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
HAL_UART_Receive_IT(&huart2,rx_buffer, sizeof(tx_buffer));
HAL_UART_Receive_IT(&huart2,rx_buffer2, sizeof(value));
}