There’s dtostrf
, see https://www.hobbytronics.co.uk/arduino-float-vars
You can also utilize the String
class
//create String object from float
String fabc(1.23, 2 /* decimal places */);
const char* x = fabc.c_str();
//iterate char-wise
for(int i = 0; i < strlen(x); i++) {
char current_char = x[i];
}
There’s also snprintf
with the %f
format specifier but for that you need to activate a setting to get floating point support, and it increases flash size, see AVR Print float in Atmel Studio 7 using sprintf() and Firmware size increased more than twice after adding _printf_float flag.