How to send and recevie data from serial print.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-28 3: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.
Labels:
- Labels:
-
STM32F0 Series
-
UART-USART
This discussion is locked. Please start a new topic to ask your question.
21 REPLIES 21
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-29 1:43 AM
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-29 4:16 AM
I write this code inside the loop. It worked. Thanks.
int size_len = sprintf (str, "Servo : %ld\n", servopot);

- « Previous
- Next »