Measure water level LCD and analog input

I've seen tutorials on how to measure water levels with analog input and the LCD displaying low, medium, full.
If the analog input is say from 100 (empty) to 800 (full) how would I convert that and display 0% to 100%
Thanks

int percentage = map(input,100,800,0,100);

or

int percentage = (input - 100) / 7;

I'm using a potentiometer as the analog input so when I get it set up and the input is a little different than the 100 to 800, the first example you have looks easier to change in the sketch
Thanks

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.