i'm doing a project in C++
the function hx_drv_uart_getchar() only receives 1 uint8_t dtype at a time. how can i convert all received characters from this function into a float array?
the string i am sending over here will be like "-1.2341, 0.9871, 4.5121~" where ~ is to let receiver know its the end of the string so the characters i am receiving will be something like '-' -> '1' ->'.' ->'2' ->'3' ->'4'-> '1'->','-> so on and so forth
how can i concatenate them and convert it into a float array: arr = {-1.2341, 0.9871, 4.5121}?
the code below is my implementation but acceldata is "45494650515249" after converting. i am suspecting its in ascii form.
so my question is how can i convert received uint8_t data to string and then convert the whole string to a float array? or are there any straightforwards ways? i've been stuck here for a few days already... please advise thank you :)
std::string acceldata;
uint8_t getchar = 0;
hx_drv_uart_getchar(&get_ch);
acceldata = get_ch;
while(get_ch != '~'){
hx_drv_uart_getchar(&get_ch);
acceldata += std::to_string(get_ch);
}