Keypad - counting 3 presses instead of 1

Hi Guys,

I have programmed a keypad matrix (which is finally correct) and Im currently using a the Password library to turn an LED on when the correct password is entered (in time it will trigger a relay or something but I am having a steep learning curve using the code!)

My question is that every time i press a key it is recorded as 3 presses in the serial monitor. I can get around this issue by extending the passcode (eg 111222333444 instead of 1234) but I wondered if there was a simple fix?

I am using 0 as the reset and 9 as the guessPassword so I would enter 012349 to turn the light on

Any advice would be greatly appreciated. I have attached the .ino file for reference

timdr23

Password_Trial_Sketch.ino (1.46 KB)

What's the hardware circuit you got going on for switch debounce?

What's your software debounce code look like?

Please read the first topics like "How to use the Forum", "How to download code etc."
My Pc refuces to download Your .png.

Doing some bending and twisting I got something.

Not knowing the keypad lib I guess.

This line of code looks strange:

void keypadEvent(KeypadEvent eKey) {

It looks like a double use of KeypadEvent. Can it be a type and a function name at the same time?

Idahowalker:
What's the hardware circuit you got going on for switch debounce?

What's your software debounce code look like?

Idahowalker, I currently have no hardware on my switch debounce, the wires are just all connected (D2-8).

I have given it a go trying to insert some debounce software into my code but it seems to give me errors with the rest of the code. Do you have any good tips for how/where to add this into my code?

Nick Gammon have launched a keybad reader using debouncing.
Let's see if this works:

https://www.gammon.com.au/forum/?id=14175

Railroader:

void keypadEvent(KeypadEvent eKey) {

It looks like a double use of KeypadEvent. Can it be a type and a function name at the same time?

keypadEvent != KeypadEvent

evanmars:
keypadEvent != KeypadEvent

Haha. Thanks! I blame my dirty spectacles, cleaned a few minutes ago.