char str[100];
float adc_read = 678.01234567; //Lectura del ADC ( como float )
int d1 = adc_read; // Get the integer part (678).
float f2 = adc_read - d1; // Get fractional part (0.01234567).
int d2 = trunc(f2 * 10000); // Turn into integer (123). , Este caso es para 4 decimales si quisieras solo 2 multiplicarias por 100 y no por 10000 y pararias aca
float f3 = f2 * 10000 - d2; // Get next fractional part (0.4567).
int d3 = trunc(f3 * 10000); // Turn into integer (4567).
sprintf (str
, "adc_read = %d.%04d%04d\n", d1
, d2
, d3
); //igual aca serian %02d el de d2