The Code is the basic Example Code with the wires in the same place.
Is there something wrong with the code or is there something wrong my LCD
It is a microtivity basic 16 pin.
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
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);
}
Well the first two support answers do not relate to the LCD display and the diagram shows a voltage dropping diode where there should be a current limiting resistor. Otherwise it is perfect.
Wired Exactly Like the example code says
I've heard that before. We need to see a photograph of your connections to verify what you are saying. Are you sure you didn't miss connecting LCD pin 5 to GND?
floresta:
He wouldn't see the blocks if the contrast wasn't set somewhere near where it should be.
With all respect Don, I have fully functioning displays that with the contrast set to the limit they display blocks and not characters. Granted it doesn't take too much adjustment to make the transition, but nonetheless it happens.
RW is wired to ground.
The first thing I check when something doesn't work is the wiring. I have never had anything fail because of my mistake in wiring.
Is there another reason for the LCD to display only blocks?
Thanks.
In 99+% of the cases the LCD itself is not the issue.
The issue comes down the external circuitry between the
Arduino and the LCD.
That reduces to errors like:
incorrectly wired
broken wires
-missing wires/components
incorrectly adjusted contrast circuit (pot)
In most cases, it comes down to a wiring error,
or missing wires/components, yet the user believes
the external circuitry is correct.
In the few cases where we have seen a bad display, it is usually
displaying nothing or partial characters or pixels.
Given yours is displaying blocks, I'd bet on wiring error or mis-adjusted
contrast pot.
You haven't shown a photo of your wiring or your LCD which is the best
method to help isolate the problem.
For instance, you saying the display is is only showing blocks on your 16x2 display.
But what does that mean?
It could be interpreted 2 ways:
32 blocks (16 blocks on both of the two lines)
16 blocks (all on one line)
Depending on which you are seeing determines which type of issue you may have.
One is due to a contrast issue, the other is due to initialization issue.
That is why people are asking to see a photo of your setup.
Firstly, the blocks are only on the first row.
Secondly, I don't have a camera that will take a picture that you can actually tell what's going on. I only have a webcam.
Is there another reason for the LCD to display only blocks?
Basically this display usually results from a problem with the wiring and/or a problem with the program code. You could, however, have a display that is horribly out of specification and in that case there could be a timing issue.
There is a library that was written to deal with 40x4 displays which have two HD44780 type controllers. It will also handle normal single controller displays. During the development of that library the author made an effort to adjust the time delays to accommodate the worst displays he could get his hands on so you might want to try it.