I want an Arduino code to give the output in following format on LCD display
If the user click 'A', 1, 2, 3 from the keypad, LCD should display Hi:1,2,3,
This is what I have tried but I cannot figure out a way to build the code as I am a beginner in arduino
#include <Keypad.h>
#include <LiquidCrystal.h>
const byte numRows= 4;
const byte numCols= 4;
char keymap[numRows][numCols]= {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[numRows] = {9,8,7,6}; // Pin Assign
byte colPins[numCols] = {5,4,3,2}; // Pin Assign
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
// LCD
// RS E D4 D5 D6 D7
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5); // Pin Assign
void setup()
{
lcd.begin(16, 2);
lcd.clear();
lcd.print("PUSH ANY KEY! ");
lcd.cursor();
lcd.blink();
}
void loop(){
char keypressed = myKeypad.getKey();
if (keypressed != NO_KEY){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(keypressed);
lcd.print(':');
lcd.setCursor(3, 0);
}
}