#include <Keypad.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(43, 45, 47, 49, 51, 53);
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {3, 2, 8, 9};
byte colPins[COLS] = {7, 6, 5, 4};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
int PWC = 0;
String ENPA="";
String len="";
void setup(){
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(11, OUTPUT);
pinMode(13, OUTPUT);
}
void Flash(int ti){
digitalWrite(13, HIGH);
delay(ti);
digitalWrite(13, LOW);
}
void loop(){
lcd.setCursor(0, 0);
lcd.print("Enter Password:");
lcd.setCursor(0, 1);
while(not PWC == 1){
char customKey = customKeypad.getKey();
if (customKey){
lcd.print("#");
tone(11, 1000, 50);
Flash(50);
ENPA += customKey;
len = strlen(ENPA);
Serial.println(len);
}
}
}
I would like to have what im pressing added to a string so that each press adds to it.
Eventually when the string is 4 characters long it will be compared to a stored variable (a password), and then if it matches you will be notified.
Yes, i realize people have made code for this exact purpose.. But this is MY idea, lol.
Please help
Error-
Enter_pass:43: error: cannot convert 'String' to 'const char*' for argument '1' to 'size_t strlen(const char*)'
** len = strlen(ENPA);**
** ^**
exit status 1
cannot convert 'String' to 'const char*' for argument '1' to 'size_t strlen(const char*)'