#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C LC(0x27,20,3);
#include <Keypad.h>
const uint8_t ROW = 4;
const uint8_t COLS = 4;
int x=5;
int xx1;
char keys[ROW][COLS] = {
{ 'P', 'A', 'T', 'T' },
{ 'A', 'N', 'A', 'S' },
{ 'A', 'K', '9', 'C' },
{ '*', '0', '#', 'D' }
};
uint8_t colPins[4] = { 5, 18, 19, 23 }; // Pins connected to C1, C2, C3, C4
uint8_t rowPins[4] = { 2, 4, 16, 17 }; // Pins connected to R1, R2, R3, R4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROW, COLS);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
LC.init();
LC.backlight();
LC.setCursor(1,0);
LC.print("samutprakan Tecnic");
LC.setCursor(5,1);
LC.print("PATTANASAK");
}
void loop() {
// put your main code here, to run repeatedly:
char key = keypad.getKey();
if (key != NO_KEY) {
if(xx1 <10){
Serial.println(key);
LC.setCursor(x,3);
LC.print(key);
x++;
}
xx1++;
}
}