Hi,
I have a 1x4 membrane keypad with wired to a Nano.
When using both example scripts in the adafruit keypad library only one key works (3) and the others only seem to work when simultaneously pressing and holding 3 then (1,2 or 4).
I am unsure if this is a code or hardware issue.
Any thoughts?
// Use this example with the Adafruit Keypad products.
// You'll need to know the Product ID for your keypad.
// Here's a summary:
// * PID3844 4x4 Matrix Keypad
// * PID3845 3x4 Matrix Keypad
// * PID1824 3x4 Phone-style Matrix Keypad
// * PID1332 Membrane 1x4 Keypad
// * PID419 Membrane 3x4 Matrix Keypad
#include "Adafruit_Keypad.h"
// define your specific keypad here via PID
#define KEYPAD_PID1332
// define your pins here
// can ignore ones that don't apply
#define R1 15
//#define R2 3
//#define R3 4
//#define R4 5
#define C1 17 // 1 - correct
#define C2 18 // 2 - correct
#define C3 19 // 3 - correct
#define C4 16 // 4 - correct
// leave this import after the above configuration
#include "keypad_config.h"
//initialize an instance of class NewKeypad
Adafruit_Keypad customKeypad = Adafruit_Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
customKeypad.begin();
}
void loop() {
// put your main code here, to run repeatedly:
customKeypad.tick();
while(customKeypad.available()){
keypadEvent e = customKeypad.read();
Serial.print((char)e.bit.KEY);
if(e.bit.EVENT == KEY_JUST_PRESSED) Serial.println(" pressed");
else if(e.bit.EVENT == KEY_JUST_RELEASED) Serial.println(" released");
}
delay(10);
}