40x 4 lcd interface with arduio


I am try to interface arduino with 40 x 4 lcd display.

I am using below mentioned code.

/* The circuit:

  • LCD RS pin to digital pin 7
  • LCD Enable pin to digital pin 6
  • LCD Enable2 pin to digital pin 8
  • LCD D4 pin to digital pin 5
  • LCD D5 pin to digital pin 4
  • LCD D6 pin to digital pin 3
  • LCD D7 pin to digital pin 2
  • LCD R/W pin to ground

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(29,26,27,38,39,40,41);

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(40, 4);
// Print a message to the LCD.
lcd.print(“hello, world!”);

void loop() {
lcd.begin(40, 4);
lcd.print(“hello, world!”);

i am not getting any message in disaply.

Hi, Two things:

  • do you have the recommended contrast potentiometer connected? Can you se any changes when you adjust it?

  • Remove the two lines inside Loop: You are constantly resetting the LCD with lcd.begin

Let us know...