Keypad interfacing with LCD

Hi,
A brief info. I'm using a 4x3 keypad (attached) and a 4x20 lcd (attached). The problem I'm having is that the keypad doesn't show the digits that I'm pressing on the keypad. Below is the code that I'm using: It is able to print out the words but it just cannot display the buttons that I pressed on the keypad. Pls give me some guidance on solving this. Thank you :slight_smile:

///////////////////----------LCD Connection------------////////////////
/*
The circuit:
LCD VDD pin to +5V
LCD V0 pin to GND
LCD RS pin to digital pin 12
LCD R/W pin to digital pin 11
LCD Enable pin to digital pin 10
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
LCD +LED pin to digital pin 13
LCD -LED pin to GND
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////----------Keypad Connection------------////////////////
/*
The circuit:
Keypad pin 1 – digital pin 12
Keypad pin 2 – digital pin 11
Keypad pin  3– digital pin 10
Keypad pin  4– digital pin 9
Keypad pin  5– digital pin 8
Keypad pin  6– digital pin 7
Keypad pin  7– digital pin 6
*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <Keypad.h>
#include <LiquidCrystal.h>


///////////////////----------Read and Store Date------////////////////////
char rsdata;
/////////////////////////////////////////////////////////////////////////////////////////

///////////////////----------Keypad Setting-------------////////////////////
const byte ROWS=4; //4 rows
const byte COLS=3; //3 columns
char key[ROWS][COLS]={
  
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'},
};

byte rowPins[ROWS]={11,6,7,9};
byte colPins[COLS]={10,12,8};

Keypad customKeypad=Keypad(makeKeymap(key) ,rowPins, colPins, ROWS, COLS);

//////////////////------------LCD Setting--------------------//////////////
int backLight = 13;    // pin 13 will control the backlight

// setup LiquidCrystal lcd variable
//                 LCD pin:  rs, r/w, enable, d4, d5, d6, d7 
//              Arduino pin:12, 11,        10,   5,   4,   3,  2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

////////////////////////////////////////////////////////////////////////////




void setup() {

Serial.begin(9600);

pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
 lcd.begin(20, 4);     // setting of LCD (4 x 20)

 // Try to print somethings on LCD (IT IS WORK FOR THIS PART)//
  lcd.print("I'm Medi the Medicine Dispenser");
  delay(2500);
  lcd.clear();
  /*lcd.print("Enter a Number");
delay(1500);*/
}
 

///////////////------void loop------////////////////////////////

void loop(){
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("Please enter hp number 1: "); // ( I can print this "HI" on LCD)
char customKey = customKeypad.getKey();  
  if (customKey!= NO_KEY){
    Serial.println(customKey);
    lcd.clear();
    lcd.setCursor(0,2);
    lcd.print("GOT KEY");
    delay(2000);
  }

}

SparkFunKeypad.png

lcd.jpg

char customKey = customKeypad.getKey();
now that you have the key, how are you sending it to the LCD?