Guys, I want to know if float variables can be used in sprintf() function.
Like, if we write:
sprintf(str,\"adc_read = %d \
Don't do this; integers in C/C++ are always rounded down so there is no need to use the floor function.
char str[100];
int d1 = value;
Better to use
int d1 = (int)(floor(value));
Then you won't get rounding up of the integer part (68.9999999999999999 becomes 69.00..). 68.09999847 instead of 68.1 is difficult to avoid - any floating point format has limited precision.