Hi
try replacing your voltmetergraph() function with the following:-
void voltmetergraph() {
for int i = 0; i < 16; i++) {
lcd.setCursor(i, 1);
if ((voltageIn >= (0.3125 * i)) and (voltageIn <= (0.3125 * (i+1))) lcd.write(255);
else lcd.write(32);
}
}
This loops round 16 times (i = 0 to i = 15) and prints a block if voltageIn is between the following values:-
if i = 0 then a block will be printed if voltageIn is between 0 and 0.3125 otherwise a space will be printed
if i = 1 then a block will be printed if voltageIn is between 0.3125 and 0.625 otherwise a space will be printed
...
...
if i = 15 then a block will be printed if voltageIn is between 4.6875 and 5 otherwise a space will be printed.
This should fix your problem an print a single block along the bottom line of the display.
N.B. The lines of the display have addresses 0 and 1 NOT 1 and 2 hence the lcd.setCursor(i, 1)
Ian