Lcd voltage display.

Hi…I tried to display the value of the change in potentiometer, with the help of LCD…My potentiometer showed values in serial window…Even my LCD showed the output…
But when i tried to merge them it didnt work…

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int a=1;
int val;
void setup()
{
lcd.begin(16, 2);
lcd.print(val);
Serial.begin(9600);
}
void loop()
{
lcd.display();
delay(500);
val=analogRead(a);
Serial.println(val);
delay(1000);
}

Can anyone plz tell me whats wrong with my program!!!

You're not sending "val" to the lcd in "loop", so the only value you'll see is the one from "setup".

Means..Should i give it in here????

( lcd.display(); )

You only have one "lcd.print", and it's in "setup".

Well you need to actually output your reading to your LCD. The display() method just turns on the display, it doesn’t write anything to the it. I would try doing something like:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int a=1;
int val = 0;
void setup()
{
lcd.begin(16, 2);
Serial.begin(9600);
}
void loop()
{
val=analogRead(a);
lcd.clear();
lcd.print(val);
Serial.println(val);
delay(1000);
}

I still dont get the output for that program in my LCD...

Actually, I tried to use the LCD without the potentiometer.Since i have only 1 potentiometer, i gave the input to a analog pin, I also gave the input and ground to LCD, but Vo pin is left alone..I m not sure where to connect it.

WHew…GOt the output…Actually, i didnt get the output coz i used the serial output…now i am getting the vaules…thanks everyone. :slight_smile: