#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <LCD_I2C.h>
#include<stdio.h>
LCD_I2C lcd(0x27); // Default address of most PCF8574 modules, change according
const byte ROWS = 4;
const byte COLS = 10;
char data[100];
int i = 0;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'},
{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'},
{'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'x'},//x delete
{'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', ' '},//. send
};
byte rowPins[ROWS] = {14, 15, 16, 17};
byte colPins[COLS] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup()
{
lcd.begin();
lcd.backlight();
}
void data_send() {
lcd.setCursor(0, 1);
lcd.print("Data send");
}
void clear() {
i = i - 1;
lcd.clear();
data[i] = ' ';
lcd.setCursor(0, 0);
lcd.print(data);
}
void loop() {
char customKey = customKeypad.getKey();
if (customKey)
{
switch (customKey)
{
case '.':
data_send();
break;
case 'x':
clear();
break;
default:
data[i] = customKey;
i += 1;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(data);
}
}
}