16x2 LCD black boxes displaying

Hey Hi

My 16x2 LCD display is having problems

All the connections are as per as the code and the pics.

The Red rail is 5V and the blue one is GND.

Here’s the code.

#include <Password.h> //http://playground.arduino.cc/uploads/Code/Password.zip use password library
#include <Keypad.h> //http://www.arduino.cc/playground/uploads/Code/Keypad.zip  //tells to use keypad library
#include <LiquidCrystal.h>

Password password = Password("2580"); //password to unlock box, can be changed

LiquidCrystal lcd(23,25,27,29,31,33);
//LiquidCrystal(rs, enable, d4, d5, d6, d7)


const byte numRows = 4; // Four rows
const byte numCols = 4; // columns
// Define the Keymap
char keys[numRows][numCols] = {
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
const byte rowPins[numRows] = {22,24,26,28}; 
const byte colPins[numCols] = {30,32,34,36}; 

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, numRows, numCols );

void setup(){
  lcd.setCursor(0, 0);
  lcd.begin(16, 2);
  lcd.print("Please enter PIN");
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
  Serial.println("Enter your 4-digit password, Press A to enter,B to try again");

void loop(){
  //take care of some special events
  void keypadEvent(KeypadEvent eKey){
    switch (keypad.getState())
     case PRESSED:
      Serial.print("You entered: ");
      lcd.print("You entered ");
      switch (eKey)
        case 'A': checkPassword(); delay(1); break;
        case 'B': password.reset(); delay(1);Serial.println("Enter Again");Serial.println("Password Reset");
              lcd.setCursor(0,1);lcd.print("Enter Again       ");delay(1500);lcd.setCursor(0,1);clearlcd(); 
        default: password.append(eKey); delay(1);
void checkPassword(){
if (password.evaluate()){  //if password is right open box
    lcd.print("Accepted     ");
    lcd.print("Welcome Souvik");
    lcd.print("Press B to Reset");
    Serial.println("Try Again");
    Serial.println("Remember Press B to reset");
    lcd.print("Denied       ");
    lcd.print("Try Again");
    lcd.print("Remember Press B to reset");
void clearlcd(){

Here are some pics

Thank you for reading!

Do help!

Here are the pics

Here are some more

Here are some more pics

Turn on the room lights and take one picture pointing straight down at your entire setup.

Also temporarily get rid of your current sketch and use something simple.

#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.print("it works!");

void loop()
                                             // do nothing in 'loop'