Hello, I have 3x4 matrix keypad (the 12 button one from Sparkfun) hooked up to an arduino Duemilanove with the matrix keypad library. I am getting repeat button presses at seemingly random intervals and I cannot figure out why. It does not appear to be caused by the way the button is pressed. I tried holding a button down for a long period of time, pressing quickly, slowly, and releasing half-way and pushing down again. None of those produced the problem consistently, so I assume it has to be an error in my code somewhere.
The code is too long to post here, so I uploaded it to pastebin:
(It is for a Airsoft/Paintball bomb prop like the one in the Counter-Strike videogame)
When a key is pressed, the loop runs correctly, verifies that the key pressed matches the stored code, and then it loops through again without waiting for a new key press for some reason. I thought it might be junk data stored in memory, so I changed the "char key;" line from the example to char "key = '\0';", and I still have the same problem.
Thanks in advance for the potential help, sorry my code is so ugly.
Yes, I used the example code from the library. Created a do loop that keeps looping until a key is pressed. I just noticed something odd though. I have tried 3 separate matrix keypads from Sparkfun, all of them have this problem. I just went out and bought a Valleman 4x4 matrix keypad from a local store, and it doesn't have this problem. So maybe its not my code? I'd like to be able to use the sparkfun keypads because they are cheaper, and I don't need the 4th column.
Heres a better description of what is happening. If I type in a series of digits, like "8507840", the arduino will read something like "885078440". The digits that are doubled are not always the same. I'm going to upload just the example code to it and see if I still get the error.