Adafruit membrane keypad works only with simultaneous press

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);
}

do you have a link to your 1x4 membrane keypad? is it really the one from adafruit?

Which "Nano" is it? (the original one or a Nano 33 IOT or ...)

Welcome to the forum

Please post a schematic of your project showing how the components are connected

1 Like

The membrane keypad came in a pihut advent calendar last year. So I cannot 100% confirm if it is an adafruit keypad however it looks exactly the same.
The Nano itself is a cheap one from ebay (JRN shop) with no brand name (Nano V3 ATmega328P).

I'll also add that I have tried this with multiple pins either side of the Nano with the same results...

It sounds like a wiring issue. Follow UKHeliBob's advice and post an annnotated schematic. Remember, we can’t see your setup and can only make guesses. Also, please post links to the technical descriptions for each of the hardware items.