hi every one
im working on a door lock with password
i was succeed to develop that but the problem was if you had changed the password after reset the board password back to defult
now im working to use EEPROM to save password
i've tried to save String into EEPROM but the EEPROM.get Show Irrelevant chars
so i find out i have to save it in char array
now my problem is how to compare user input password with password i've read from EEPROM.get
or how to convert char array into String so i can use String class functions
Sorry for the messy code
#include<Wire.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte ROWS_COUNT = 4;
const byte COLUMNS_COUNT = 4;
char Keys_map [ROWS_COUNT][COLUMNS_COUNT] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte ROWS[ROWS_COUNT] = {2, 3, 4, 5};
byte COLUMNS[COLUMNS_COUNT] = {6, 7, 8, 9};
char inputKey = '&';
bool Check = false;
int del = 300;
char Saved_PASS[10];
char Input_PASS [10];
int door = 10;
bool PASS_Change = false;
char change_password [10];
int index = 0;
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("*Enter PASSWORD*");
pinMode(door , OUTPUT);
digitalWrite(door, HIGH);
EEPROM.get(0, Saved_PASS);
Serial.println(Saved_PASS);
}
void loop() {
pinmode();
inputKey = KeyCheck ();
pass_Check();
}
void pinmode() {
for (int i = 0; i < 4; i++) {
pinMode(ROWS[i], OUTPUT);
digitalWrite(ROWS[i], LOW);
pinMode(COLUMNS[i], INPUT_PULLUP);
}
}
char KeyCheck () {
char pressed_Key = '&';
for (int j = 0; j < 4; j++) {
if (digitalRead(COLUMNS[j]) == 0) {
pinMode(COLUMNS[j], OUTPUT);
digitalWrite(COLUMNS[j], LOW);
for (int i = 0; i < 4; i++) {
pinMode(ROWS[i], INPUT_PULLUP);
if (digitalRead(ROWS[i]) == 0) {
delay(del);
pressed_Key = Keys_map[i][j];
Check = true;
return pressed_Key;
}
}
}
}
}
void pass_Check() {
if (inputKey >= '0' && inputKey <= '9' && Check == true) {
Input_PASS[index] = inputKey;
inputKey = '&';
Check = false;
index++;
Serial.println(Input_PASS);
}
}