LCD not working

My LCD is not working.
I'm using an Arduino Deumilanove and the LCD is stuck with the backlight on and the top row fully illuminated with white where the letters should be.
this is one of the codes I've tried to use to get it to work.
Please Help.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  lcd.clear();
  delay(2000);
  lcd.print("hello, world");
}

void loop() {}

This is what happens to mine although mine is a shield.
http://forum.arduino.cc/index.php?action=dlattach;topic=288263.0;attach=107202;image

Try this code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  delay(2000);
  lcd.print("hello, world");
}


void loop() {
}

You miss the line "lcd.begin(16, 2);".

oops
but nope
is still just displaying a row of blocks on the top row.

This is the only code that prints and that prints "BL CIRCUIT GOOD"

/*
 * sketch to test lcd keypad shields for bad backlight circuitry
 *
 * See this Arduino forum thread for a discussion about the isue:
 * http://forum.arduino.cc//index.php?topic=96747
 *
 * To use, fill in the proper pin assignements if they are different
 * from below.
 *
 * upload the sketch.
 * The LCD display will show whether the backlight circuit is good/bad.
 *
 * If the sketch shows that the backlight hardware is bad, all is not
 * lost, the shield can still be used and the backlight can still
 * be controlled. Just keep in mind that unless the hardware is
 * modified/repaired some precautions must be taken when controlling the backlight.
 * The main thing is that pin should never be set to HIGH.
 * This means that PWM or analogWrite() cannot be used to dim the backlight.
 *
 * If you are happy with the backlight on all the time, then nothing needs to be done.
 * A simple software only solution for backlight on/off control
 * is to set the backlight pin to INPUT to turn on
 * the backlight and set the backlight pin to OUTPUT mode to turn the backlight off.
 * 
 * You can also grab and use the SafeBLon()/SafeBLoff() macros below in your sketch
 * to turn the backlight on/off.
 * These macros will work regardless of the BL circuit.
 *
 * Created by Bill Perry 2013-10-29
 * bperrybap@opensource.billsworld.billandterrie.com
 *
 */

// include the Liquid Crystal library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
const int pin_RS = 8; // arduino pin wired to LCD RS
const int pin_EN = 9; // arduino pin wired to LCD EN
const int pin_d4 = 4; // arduino pin wired to LCD d4
const int pin_d5 = 5; // arduino pin wired to LCD d5
const int pin_d6 = 6; // arduino pin wired to LCD d7
const int pin_d7 = 7; // arduino pin wired to LCD d8

const int pin_BL = 10; // arduino pin wired to LCD backlight circuit

LiquidCrystal lcd( pin_RS,  pin_EN,  pin_d4,  pin_d5,  pin_d6,  pin_d7);


/*
 * Macros to safely turn on the backlight even with back BL hardware
 * These assume that the BL pin is not touched or used after RESET other
 * that by these macros.
 */

#define SafeBLon(pin) pinMode(pin, INPUT)
#define SafeBLoff(pin) pinMode(pin, OUTPUT)

int status;

void setup()
{
	// set up the LCD's number of columns and rows: 
	lcd.begin(16, 2);

	status = pinTest(pin_BL); // only run the actual test once
}

void loop()
{

	lcd.clear();
	if(status)
	{
		/*
		 * Shield has BL circuit issue
	 	 */
		lcd.print("BL Circuit BAD");
		safeBlink(pin_BL, 5); // safely blink the backlight
	}
	else
	{
		/*
		 * Shield is OK (no BL circuit issue)
	 	 */
		lcd.print("BL Circuit GOOD");
		softBlink(pin_BL, 2); // soft blink the backlight (uses PWM)
	}

	delay(1000);
}

/*
 * Function to test a backlight pin
 * Returns non-zero if test fails (bad circuit design)
 */
int pinTest(int pin)
{
int val;

	/*
	 * Check to see if there
	 * is a problem in the backlight circuit
	 * So far, the "broken" designs connected D10
	 * directly to the base of a NPN transistor,
	 * this will cause a short when D10 is set to HIGH
	 * as there is no current limiting resistor in the path
	 * between D10 to the base and the emitter to ground.
	 */

	/*
	 * Set the  pin to an input with pullup disabled.
	 * This should be safe on all shields.
	 * The reason for the digitalWrite() first is that
	 * only the newer Arduino cores disable the pullup
	 * when setting the pin to INPUT.
	 * On boards that have a pullup on the transistor base,
	 * this should cause the backlight to be on.
	 */
	digitalWrite(pin, LOW);
	pinMode(pin, INPUT);

	/*
	 * Set the backlight pin to an output.
	 * since the pullup was turned off above by
	 * setting the pin to input mode,
	 * it should drive the pin LOW which should
	 * be safe given the known design flaw.
	 */
	pinMode(pin, OUTPUT);


	/*
 	 * Set the backlight pin to HIGH
	 * NOTE: This is NOT a safe thing to do
	 * on the broken designs. The code will minimize
	 * the time this is done to prevent any potential damage.
	 */

	digitalWrite(pin, HIGH);

	
	/*
	 * Now read back the pin value to
	 * See if a short is pulling down the HIGH output.
	 */

	delayMicroseconds(5); // give some time for the signal to droop

	val = digitalRead(pin); // read the level on the pin

	/*
 	 * Restore the pin to a safe state
	 * Input with pullup turned off
	 */
	digitalWrite(pin, LOW);
	pinMode(pin, INPUT);

	/*
	 * If the level read back is not HIGH
	 * Then there is a problem because the pin is
	 * being driven HIGH by the AVR.
	 */
	if (val != HIGH)
		return(-1); // test failed
	else
		return(0); // all is ok.
}

void safeBlink(int pin, int count)
{
	/*
	 * Safely blink the backlight on LCD shields that have
	 * broken BL hardware
	 * Uses the SafeBL macros defined above.
	 */

	while(count--)
	{
		delay(200);
		SafeBLoff(pin); // turn on the backlight (safe to use for all shields)
		delay(50);
		SafeBLon(pin); // turn off the backlight (safe to use for all shields)
	}
}

/*
 * soft blink the backlight.
 * NOTE: this should not be used on a shield
 * with a bad backlight circuit
 */
void softBlink(int pin, int count)
{
	// soft blink the backlight by ramping down then back up
	pinMode(pin, OUTPUT);
	for(int times = 0; times < count; times++)
	{
		for(int x = 1; x < 16; x++)
		{
			analogWrite(pin, 256-x * 16);
			delay(50);
		}
		for(int x = 1; x < 16; x++)
		{
			analogWrite(pin, x * 16);
			delay(50);
		}
	}
}

Where did you guys get those sketches?

Both of them show an unneeded delay. One shows an unneeded clear and the other shows an unneeded cursor positioning. None of these would cause the display to not work but they are indicative of a lack of knowledge of how the LiquidCrystal library works.

Both of them show seven pins in the parentheses indicating that you are connecting the R/W pin to the Arduino. This isn't a problem if you actually connect R/W to digital pin 11 but most people just connect it to GND an show six pins in the LiquidCrystal lcd(...) statement.

The first program shows no loop() which is bad, the second shows an empty loop() which is good.

Try this sketch and make sure that R/W (LCD pin 5) is connected to GND and that your LiquidCrystal lcd(...) statement matches your connections (or vice versa).

#include <LiquidCrystal.h>

//LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);      // put your pin numbers here

void setup()
  {
  lcd.begin(16, 2);                          // put your LCD parameters here
  lcd.print("hello, world!");
  lcd.setCursor(0,1);
  lcd.print("it works!");
  }

void loop()
  {
  }

Don

This is the only code that prints and that prints "BL CIRCUIT GOOD"

You didn't mention that you were using an LCD Keypad shield. . .

Don

That's alright
because this code works

#include <LiquidCrystal.h>
const int pin_RS = 8; // arduino pin wired to LCD RS
const int pin_EN = 9; // arduino pin wired to LCD EN
const int pin_d4 = 4; // arduino pin wired to LCD d4
const int pin_d5 = 5; // arduino pin wired to LCD d5
const int pin_d6 = 6; // arduino pin wired to LCD d7
const int pin_d7 = 7; // arduino pin wired to LCD d8
const int pin_BL = 10; // arduino pin wired to LCD backlight circuit
LiquidCrystal lcd( pin_RS,  pin_EN,  pin_d4,  pin_d5,  pin_d6,  pin_d7);

void setup()
{
lcd.begin(16, 2);
lcd.begin(16, 1);
}

void loop()
{
  lcd.clear();
  lcd.print("Decided To Work!");
}

The right side is busted I think

because this code works . . .

I doubt it. Have you tried to write to the second line?

The right side is busted I think

No. The code is busted.

Hint: Don't do anything in loop() until you are able to write to both lines in setup().

Don

alright have figured out that problem too
i had clear above print with no delay

I'll be here when you come back.

Don

Hi, i have a problem with this Display and the LiquidCristal.h.

When compiling the simple HelloWorld.ino the compiler stops on a SPI error, but i have no SPI display
just parallel, or are there 2 versions form the LiquidCristal.h. ????

@Bert46

That is a different problem and should be in a new thread.

As you have probably just learned it would be a good idea to make your title a bit more descriptive than 'LED not working'.

Don