0

I'm getting data from an ADC through SPI: I save the data into an array of type uint16_t and I use a terminal to see the result.

How can I see this result in decimal instead of unsigned int?
I need to know if the values I get are what I really want.
My code is in C.

uint16_t mVals[6] = {0, 0, 0, 0, 0, 0}; printf("%u\n\r", (unsigned)mVals[0]

This is how I print.
But i would like to see number in decimal on the terminal.
I even have a write function to have the printf working:

int _write(int FD, char buffer, int len){
    HAL_UART_Transmit(&huart2, (uint8_t)buffer, len, 1000); return len;
}

Marc

Louys Patrice Bessette
  • 33,375
  • 6
  • 36
  • 64
  • 1
    Hi! Can you show some code about the problem? – Dherik Oct 04 '16 at 20:47
  • uint16_t mVals[6] = {0, 0, 0, 0, 0, 0}; printf("%u\n\r", (unsigned)mVals[0]. This is how I print. But i would like to see number in decimal on the terminal. I even have a write function to have the printf working: int _write(int FD, char *buffer, int len){ HAL_UART_Transmit(&huart2, (uint8_t*)buffer, len, 1000); return len; } – Marc203 Oct 04 '16 at 22:07

0 Answers0