LCD display only showing black boxes.

I bought a LCD display and plugged it in this way:

Pin 1 to Arduino GND
Pin 2 to Arduino 5V
Pin 3 to Arduino pin 6
Pin 4 to Arduino pin 12
Pin 5 to Arduino GND
Pin 6 to Arduino pin 11
Pin 11 to Arduino pin 5
Pin 12 to Arduino pin 4
Pin 13 to Arduino pin 3
Pin 14 to Arduino pin 2

programming:

#include <LiquidCrystal.h>
LiquidCrystal lcddisplay(12, 11, 5, 4, 3, 2);
void setup() {
pinMode(6,OUTPUT);
analogWrite(6,15);
lcddisplay.begin(16, 2);
lcddisplay.print("Arduino");
}

void loop() {
lcddisplay.setCursor(0, 1);
lcddisplay.print(millis()/1000);
}

And when I run it there are only black boxes on the first row.

I have rechecked the soldering.
Please HELP!

Badly adjusted contrast? It might be helpful to provide exactly what model of LCD you bought and from where...

Regards,

Graham

The contrast voltage is normally set with a resistor rather than the pwm approach you are using.

If you don't have the traditional pot to set the contrast, you can use a fixed resistor from Vo to ground. Typically the value will be less than 2k but probably greater than 470 ohm.

If you indeed must use PWM, most tutorials I have seen use a fairly large capacitor 10-100 microfarad between the Vo pin and ground, and the pwm setting is more like 50 than 15.

Get your display running with a traditional pot to set the contrast and with a simple message generated in setup(). Preferably don't try to do anything in loop().

You can mess with variable contrast, which is hardly ever needed, later.

Don

It would be interesting to know from what site/ blog you obtained the instructions to do that?

it is somewhat helpful for us to know which sources are such a total disaster for the "newbies". "Instructables" seems to be a good source of bad information.

That you are getting the "blocks" indicates that the contrast is working to some extent, but using PWM to set it when a resistor is all that is required - and probably works better - is not a good idea. So for starters, you should sort out that matter. Try a 470 ohm resistor from pin 3 to ground.

Now the "blocks" indicate that you are in fact, not "talking" to the display controller, though it is possible that there is some interaction with the code.

Try wiring pin 3 of the LCD to ground with a 470 ohm resistor and running this version of the test code:

#include <LiquidCrystal.h>
LiquidCrystal lcddisplay(12, 11, 5, 4, 3, 2);
void setup() {
  lcddisplay.begin(16, 2);
  delay(100);  
  lcddisplay.print("Arduino");
  delay(3000);
}

void loop() {
  lcddisplay.setCursor(0, 1);
  lcddisplay.print(millis()/1000);
  delay(500);
}