hi, I am trying to test with a LCD displays with Arduino Uno , i am totally new to this technology, though followed the steps, still can't control the contrast and no text is appearing...thank you for instruction here!
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
}
The row of 16 blocks on the top line and nothing on the bottom line is the normal pattern when either the connections or the sketch are incorrect.
Please post a schematic, drawn from the circuit you have built, not someone else's. Please edit your post above and put in the code tags so that it does not break the forum rules.
It looks like it's been nearly ten years since I posted this . . .
Here's my quick and dirty LCD setup procedure from a recent post:
Get the backlight working first (pins 15 and 16).
Connect the power and the contrast next (pins 1, 2, and 3). Any potentiometer
between 5K and 50K will work. With the potentiometer at one end of it's range
the display will be blank and at the other end you should see boxes on the top
line of the display. Adjust the potentiometer until the row of boxes is visible,
but dim. The voltage at pin 3 should be around 0.5v at this point. If you do not
get this behavior then it makes no sense to continue since no amount of
programming will fix things.
Connect the other seven pins (4, 5, 6, 11, 12, 13, and 14) and load up your sketch.
Using an I2C enabled LCD is much easier if you use the hd44780 library. That library, unlike any other, will automatically detect the backpack's I2C address and also the backpack to LCD pin mapping. That makes it pretty much plug and play. Just adjust the contrast pot for the best viewing. The hd44780 library is available via the IDE library manager.