José Carlos Pinto Miranda said:
By the way...
I don't know the compiler you use, but usually in C language when You print a float one uses %f instead of %d. However I can't be sure about your compiler since it is a version microcontroller aplicable...
Anyway, I would try to change the line:
sprintf(outString,"A2D = %d.%d volts",voltage);
to something like:
sprintf(outString,"A2D = %1.2f volts",voltage);
(since you divide by 51.0 maximum integer part would be 5 that corresponds to 1 digit, and as for the decimal part... who cares about milivolts on a proximity sensor where there is always a significant reading error)