cancel
Showing results for 
Search instead for 
Did you mean: 

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?

ZKURT.1
Senior
 
1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

1 REPLY 1
TDK
Guru

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".