creating a passcode lock using a keypad and display on the node mcu

Trying to make a passcode lock using the node mcu (ESP8266) however after the upload finishes nothing ever really shows up on the display, and for some reason, this is what populates my serial monitor

//

-Exception (9):
epc1=0x402045a1 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4020494d depc=0x00000000

stack>>>

ctx: cont
sp: 3ffffdd0 end: 3fffffc0 offset: 0190
3fffff60: 007a1200 5cb3d7c2 3ffee300 3ffee5f8
3fffff70: 3fffdad0 00000000 3ffee358 402018f1
3fffff80: 50104000 54144000 3ffee358 4020193a
3fffff90: 3fffdad0 00000000 3ffee5b8 40201117
3fffffa0: 3fffdad0 00000000 3ffee5b8 40202474
3fffffb0: feefeffe feefeffe 3ffe8500 40100ed9
<<<stack<<<
⸮⸮⸮⸮z⸮

//

Heres a look at my code.
I have not connected all 8 pins of the keypad since I do not require the alphabets in the last column and i have also utilized D1 and D2 for the sda and scl going to my display which is an i2c 1602 hd 44780. any help fixing this would be great :smiley:

#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include "Keypad.h"
#include "Wire.h"

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns

char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

byte rowPins[ROWS] = {D0, D3, D4, D5};
byte colPins[COLS] = {D6, D7, D8};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27);
const int len_key = 5;
char master_key[len_key] = {'1','2','3','4','1'};
char attempt_key[len_key];
int z=0;

void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Insert Password");
}

void loop() {
char key = keypad.getKey();
lcd.setCursor(z-1,1);
lcd.print("");
if (key){
switch(key){
case '
':
delay(3000);
z=0;
break;
case '#':
delay(3000); // added debounce
checkKEY();
break;
default:
attempt_key[z]=key;
z++;
}

}
}

void checkKEY()
{
int correct=0;
int i;
for (i=0; i < len_key; i++) {
if (attempt_key==master_key*) {
_
correct++;_
_
}_
_
}_
if (correct==len_key && z==len_key){
_
lcd.setCursor(0,1);_
_
lcd.print("Correct Key");_
_
delay(3000);_
_
z=0;_
_
lcd.clear();_
_
lcd.setCursor(0,0);_
_
lcd.print("Insert Password");_
_
}_
_
else*_
* {*
* lcd.setCursor(0,1);*
* lcd.print("Incorrect Key");*
* delay(3000);*
* z=0;*
* lcd.clear();*
* lcd.setCursor(0,0);*
* lcd.print("Insert Password");*
* }*
* for (int zz=0; zz<len_key; zz++) {
attempt_key[zz]=0;
_
}_
_
}*_

@nishdel101

Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum and pay specific attention to point #7 about posting code. Next modify your post and add the code tags so we don't have to read a corrupted sketch.

nishdel101:
Trying to make a passcode lock using the node mcu (ESP8266) however after the upload finishes nothing ever really shows up on the display, and for some reason, this is what populates my serial monitor

//

-Exception (9):
epc1=0x402045a1 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4020494d depc=0x00000000

stack>>>

ctx: cont
sp: 3ffffdd0 end: 3fffffc0 offset: 0190
3fffff60: 007a1200 5cb3d7c2 3ffee300 3ffee5f8
3fffff70: 3fffdad0 00000000 3ffee358 402018f1
3fffff80: 50104000 54144000 3ffee358 4020193a
3fffff90: 3fffdad0 00000000 3ffee5b8 40201117
3fffffa0: 3fffdad0 00000000 3ffee5b8 40202474
3fffffb0: feefeffe feefeffe 3ffe8500 40100ed9
<<<stack<<<
⸮⸮⸮⸮z⸮

//

Heres a look at my code.
I have not connected all 8 pins of the keypad since I do not require the alphabets in the last column and i have also utilized D1 and D2 for the sda and scl going to my display which is an i2c 1602 hd 44780. any help fixing this would be great :smiley:

#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include "Keypad.h"
#include "Wire.h"

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns

char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

byte rowPins[ROWS] = {D0, D3, D4, D5};
byte colPins[COLS] = {D6, D7, D8};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27);
const int len_key = 5;
char master_key[len_key] = {'1','2','3','4','1'};
char attempt_key[len_key];
int z=0;

void setup() {
Serial.begin(9600);
lcd.begin(16,2);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Insert Password");
}

void loop() {
char key = keypad.getKey();
lcd.setCursor(z-1,1);
lcd.print("");
if (key){
switch(key){
case '
':
delay(3000);
z=0;
break;
case '#':
delay(3000); // added debounce
checkKEY();
break;
default:
attempt_key[z]=key;
z++;
}

}
}

void checkKEY()
{
int correct=0;
int i;
for (i=0; i < len_key; i++) {
if (attempt_key==master_key*) {
_
correct++;_
_
}_
_
}_
if (correct==len_key && z==len_key){
_
lcd.setCursor(0,1);_
_
lcd.print("Correct Key");_
_
delay(3000);_
_
z=0;_
_
lcd.clear();_
_
lcd.setCursor(0,0);_
_
lcd.print("Insert Password");_
_
}_
_
else*_
* {*
* lcd.setCursor(0,1);*
* lcd.print("Incorrect Key");*
* delay(3000);*
* z=0;*
* lcd.clear();*
* lcd.setCursor(0,0);*
* lcd.print("Insert Password");*
* }*
* for (int zz=0; zz<len_key; zz++) {
attempt_key[zz]=0;
_
}_
_
}_
_
[/quote]*_
quoting test. do not delete

bump

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.