Search code examples
carraysstringuint8t

array of uint8_t and append data


hi to all i have this problem i have a array of uint8_t

uint8_t command_Text[256]

i read some data from adc, i use snprintf for convert the data float in uint8_t

` float aux;
uint8_t value[4];  
aux=(float)(HAL_ADC_GetValue(&hadc))
 snprintf(value,4,"%.0f",aux);   //convert the data float to uint8_t
 strcat(command_Text, value);   //append data `

i see this Warning argument of type "uint8_t *" is incompatible with parameter of type "char const * i don't know manipolate the string in uint_8 data, i want read data e to append it in to array, can you help me?


Solution

  • Suggest something like:

    uint8_t command_Text[256] = {'\0'};
    ....
    uint8_t value[4] = {'\0'};  
    snprintf(value,3,"%3.3u", atoi( HAL_ADC_GetValue( &hadc ) ) );   
    strcat(command_Text, value);   //append data