#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
byte customChar[8] = {
B00000,
B01010,
B11111,
B11111,
B01110,
B00100,
B00000,
B00000
};
LiquidCrystal_I2C lcd (0x27, 16, 2);
const uint8_t ROWS = 4;
const uint8_t COLS = 4;
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
const uint8_t rowPins[ROWS] {2, 3, 4, 5};
const uint8_t colPins[COLS] {6, 7, 8, 9};
bool aa = false;
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
char key;
uint8_t curPos = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.createChar(0, customChar);
lcd.clear();
lcd.print("Hello");
lcd.print(" World");
delay(2000);
lcd.setCursor(2, 1); // oszlop, sor
lcd.write(customChar);
lcd.setCursor(0, 1);
}
void loop() {
// put your main code here, to run repeatedly:
key = keypad.getKey();
if (key != NO_KEY) {
lcd.print(key);
lcd.setCursor(curPos, 1);
delay(1000);
lcd.print("*");
curPos++;
if (key == 'D') {
pinMode(12, OUTPUT);
digitalWrite(12, HIGH);
delay(1000);
lcd.clear();
lcd.print("RESET");
delay(1000);
lcd.clear();
}
}
}