Incomprehensible Error with my loops

KurwaClown:
I just typed the current needed in the if, don't want to add something for the distance since I know 1.5V is what I need.

But then, converting the ADC to a float is also not needed, as pointed out. floats are a particularly bad way to use comparisons for limit testing, by the way.

if you use for example centimeters instead of voltage, you may also eliminate the error that may come from ADC readings that are within the bounds of one centimeter unit.

to help solve your fundamental issue, refer to the StateChangeDetection example in the IDE.