AnsweredAssumed Answered

Sending integers over USART as ASCII characters, using HAL Libraries

Question asked by salih kan on Feb 27, 2018
Latest reply on Mar 3, 2018 by Bogdan Golab

Hello Everyone;

To send ASCII characters via USART I normally use Hal libraries and the function below;

HAL_UART_Transmit(&huart2, (uint_t*)"Hello", 6,10);

But, that one is for characters only. How can I send the value of an integer over USART as its ASCII characters ? Which functions and libraries should I use ?
. .
. For example (dummy program just to show my purpose):

int i = ADC read value; //Lets say i=15

printf(i); //value should be sent in ASCII characters, so 1 and then 5 should be sent in ASCII.
. .
.

Thanks for your help, Kind regards

Salih

Outcomes