Skip to main content
ZKURT.1
Senior
December 29, 2021
Solved

Hi. I will send the data from the temperature sensor with the RF module. I can send unsigned char with RF module. Data integer from temperature and humidity sensor. How can I convert an integer data type to an unsigned char data type?

  • December 29, 2021
  • 1 reply
  • 924 views

..

This topic has been closed for replies.
Best answer by TDK

No doubt the RF module sends bytes, not any particular data type. How you interpret those bytes on the other end is up to the receiving software. Provide a pointer to the data using a cast.

int x = 67;
HAL_UART_Transmit(huart1, (unsigned char *) &x, sizeof(x), 0);

1 reply

TDK
TDKBest answer
Super User
December 29, 2021

No doubt the RF module sends bytes, not any particular data type. How you interpret those bytes on the other end is up to the receiving software. Provide a pointer to the data using a cast.

int x = 67;
HAL_UART_Transmit(huart1, (unsigned char *) &x, sizeof(x), 0);

"If you feel a post has answered your question, please click ""Accept as Solution""."