I’m trying to develop code in Arduino ide so that when I put the right passcode in on 4x4 keypad and press # button it makes the buzzer make a sound and when I put the wrong passcode in it makes a red led light up, for some reason my code is not working, any recommendations?
#include <Keypad.h>
#include <ezBuzzer.h>
const int BUZZER_PIN = 12;
const int ROW_NUM = 4;
const int COLUMN_NUM = 4;
const int LED = 11;
const byte keys [4][4] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'},
};
byte pin_rows[ROW_NUM] = {9, 8, 7, 6};
byte pin_column[COLUMN_NUM] = {5, 4, 3, 2,};
Keypad keypad = Keypad(makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM);
ezBuzzer buzzer(BUZZER_PIN);
String inputString;
long inputInt;
void setup() {
Serial.begin(9600);
inputString.reserve(10);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(LED, OUTPUT);
}
void loop() {
//keypad.getKey();
buzzer.loop();
char Key = keypad.getKey();
if (4557 == '#') {
Serial.println(Key);
buzzer.beep(100);
}
else if (4557 == false) {
digitalWrite(11, HIGH);
}
}