So i was trying to connect lcd 1206 from elegoo pack to my mega 2560 r3 board and display basic hello world but see white squares 5x5 and dark blue rectangles 5x8. I tried using solution from in the last post this forum LCD only show squares - SOLVED but it didn’t work for me
Can you verify your wiring for Uno pins 7, 8, 9, 10, 11, 12? With breadboards, it sometimes looks like the pin is being inserted in the correct socket, but is actually one-pin off.
It is very common to see those solid blocks (often called "ghost blocks") when first setting up an LCD. It usually means the screen has power but hasn't been properly initialized by the code or the contrast is off.
Based on your photo and code, there are three likely reasons why this isn't working:
1. Contrast Adjustment (Most Likely)
The small black knob on your breadboard is a potentiometer used to adjust the contrast. If it is turned too far in one direction, the screen will only show solid rectangles; too far the other way, and the text will be invisible.
Fix: While the board is powered on, slowly turn the knob of the potentiometer from one extreme to the other. You should eventually see the "Hello, World!" text appear through the blocks.
2. Code vs. Hardware Mismatch
In your code, you have defined the LCD pins as:
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
The standard order for this function is: (RS, Enable, D4, D5, D6, D7).
Looking at your image, it is difficult to trace every wire, but if you followed the standard Elegoo tutorial, you might have swapped the RS and Enable pins or the data pins.
Fix: Double-check that Pin 7 on your Mega is going to the RS pin on the LCD, and Pin 8 is going to the Enable pin. If they are swapped, the screen will never initialize.
3. The lcd.begin Dimensions
You are using a 16x2 LCD (two rows of 16 characters), but your code says:
lcd.begin(16, 4);
Fix: Change that line to lcd.begin(16, 2);. While this usually doesn't cause the "blocks" issue, it can cause text to wrap incorrectly or fail to display on the second line.
Troubleshooting Checklist
If the contrast knob doesn't fix it, try these steps:
Check for "Floaters": Ensure the jumper wires are pushed firmly into the breadboard. If one of the data pins (D4–D7) is loose, the screen will stay on "blocks."
Verify Ground: Ensure the LCD's R/W pin (usually pin 5) is connected to GND. If it’s floating, the LCD won't receive commands.
Check Power: Ensure you are using the 5V pin on the Mega, not 3.3V, as these screens typically require 5V to drive the logic correctly.
i also tried connecting rw to mother board as in LC lib but did not helped either.
Update, tried as well connecting it from zero to a different breadboard, same issue.
Do not do this... see post #18. This connects an output HIGH to an output LOW.
I was trying to make a shorting pin check with fewest connections. Do not do this.
First, please, disconnect power from the breadboard, and remove all connections.
Next... would you wire your LCD to your MEGA2560 like this... (using the pins for LCD, jumper them to the ground-rail of the breadboard.
const int pin[] = {12, 11, 10, 9, 8, 7};
void setup() {
for (int i = 0; i < 6; i++) {
pinMode(pin[i], OUTPUT);
}
pinMode(LED_BUILTIN, INPUT);
delay(1000);
}
void loop() {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < pin[i]; j++) {
digitalWrite(pin[i], HIGH);
delay(100);
digitalWrite(pin[i], LOW);
delay(300);
}
delay(3000);
}
delay(5000);
}
If the output ports (7, through 12) work correctly, you will see the "L" LED blink 12 times, then pause for three seconds, then blink 11 times, and pause, then 10, 9, 8, 7, then pause for five seconds. This is to test the ability of the pins being used are capable of "OUTPUT."
yes, i tried different things while waiting for responses in forum, because didnt wanted to just sit around and wait, i will now try what xfpd recommended.