1

I used this example code:

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
}

void loop(){
  char key = keypad.getKey();

  if (key != NO_KEY){
    Serial.println(key);
  }
}

And when I upload it to my Arduino and start the Serial Monitor, it prints a 1 and that's it. No other output if I press the keys. I have a 4x4 Keypad and used this Guide from Hackster.io.

It prints a 1 without pressing a button. It does not recognize any key press. There is no shortcut i change the cable and they are right I used another keypad same problem :(

How to get other values?

closed as unclear what you're asking by sempaiscuba, gre_gor, Greenonline, MatsK, Juraj Oct 23 '18 at 20:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Does it print a '1' without pressing a button? It does not recognize any key press? Then something is stuck and pin 5 is shortcut with pin 8. It might be wrong wiring or a broken keypad. – Jot Oct 22 '18 at 13:35
  • sorry i cant comment thats the reason why i answer here. Yes it prints a 1 without pressing a button. It does not recognize any key press. There is no shortcut i change the cable and they are right I used another keypad same problem :( – user50548 Oct 22 '18 at 13:57
  • 4
    Please add the wiring to complete your question. You seem to be using another setup compared to the original??!! – Mikael Patel Oct 22 '18 at 14:01
  • 2
    do you have the baud rate in Serial Monitor 9600 baud? – Juraj Oct 22 '18 at 14:14