/*
  Arduino Keypad Lock

  From:
  Wokwi | questions
  I need help for my school project

  mammm? — 10/27/24 at 12:40 PM
  make a door lock using Arduino, servo, keypad,
  LCD 16x2 (12C), and buzzer (someone plzz)
*/

#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
#include <Servo.h>
#include "icons.h"

const int PASSCODE[] = {1234};
const int BUZZ_PIN = 4;
const int SERVO_PIN = 3;

const byte KEYPAD_ROWS = 4;
const byte KEYPAD_COLS = 4;
byte rowPins[KEYPAD_ROWS] = {12, 11, 10, 9};
byte colPins[KEYPAD_COLS] = {8, 7, 6, 5};
char keys[KEYPAD_ROWS][KEYPAD_COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

Servo lockServo;
LiquidCrystal_I2C lcd(0x27, 16, 2);
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, KEYPAD_ROWS, KEYPAD_COLS);

void setup() {
  Serial.begin(115200);
  lcd.init();
  lcd.backlight();
  initIcons(lcd);
  lcd.setCursor(0, 0);
  lcd.print("Hello 1 ");
  lcd.write(ICON_UNLOCKED_CHAR);
  lcd.setCursor(0, 1);
  lcd.print("Hello 2 ");
  lcd.write(ICON_LOCKED_CHAR);
  //lcd.write(ICON_RIGHT_ARROW);
}

void loop() {
  // put your main code here, to run repeatedly:
}