2020-10-28 03:21 AM
I'm using servo and driving it with servo motor. I want to print the servo degree via UART to serial. But im getting unknown characters. My code is;
/* USER CODE BEGIN 0 */
uint32_t potadc;
uint32_t servopot;
/* USER CODE END 0 */
/* USER CODE BEGIN 1 */
char str[16];
/* USER CODE END 1 */
HAL_UART_Transmit(&huart2, (uint32_t)*str, sprintf(str, "Servo : %d\n", servopot), 0xFFFF);
HAL_Delay(1);
Thanks in advance.
Solved! Go to Solution.
2020-10-29 01:43 AM
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
2020-10-29 04:16 AM
I write this code inside the loop. It worked. Thanks.
int size_len = sprintf (str, "Servo : %ld\n", servopot);