Try this, instead of the previous:
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //initialize the library, numbers of the interface pins
int analogInput = 1; //analog pin A1
unsigned long VoltageIn = 0; // [mV]
int refresh = 50; //refresh rate
void setup()
{
pinMode(analogInput, INPUT); //setting analog pin mode to input
lcd.begin(16, 2); //setting up the LCD screens rows and columns
lcd.print("Voltage=");
lcd.setCursor(13, 0); lcd.print('V');
}
void loop()
{
//value = analogRead(analogInput); //reading the value on A1
//VoltageOut = (value * 5.0) / 1024.0;
//VoltageOut / (R2/(R1+R2));
VoltageIn = analogRead(analogInput) * 5000 / 1024;
lcd.setCursor(8, 0); //setting LCD cursor
lcd.print(int(VoltageIn/1000)); lcd.print('.'); lcd.print(int(VoltageIn/10)%100);
delay(refresh); //screen refresh delay
voltmetergraph(); //calling my function voltmetergraph
}
void voltmetergraph()
{
int step=280; // mV
for(int i=0; i<16; i++)
{lcd.setCursor(i,0); if(VoltageIn>=step*(i+1) && VoltageIn<step*(i+2)) lcd.write(255); else lcd.print('-');}
}