Code: Select all
#include <Wire.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A',},
{'4','5','6','B',},
{'7','8','9','C',},
{'*','0','#','D',},
};
byte rowPins[ROWS] = {14, 27, 26,25};
byte colPins[COLS] = {4, 16, 17, 5,};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup()
{
Serial.begin(115200);
keypad.addEventListener(mykeypadEvent);
}
void mykeypadEvent(KeypadEvent key){
Serial.printf("in event, key: %d, state=%d\n", key,keypad.getState());
}
void loop()
{
char key = keypad.getKey();
if (key != NO_KEY)
Serial.printf("key: %c pressed\n", key);
}
byte rowPins[ROWS] = {26,25,33,32};
byte colPins[COLS] = {15,2,0,4};
this combination fails, seems pin16, pin17
byte rowPins[ROWS] = {26,25,33,32};
byte colPins[COLS] = {4,16,17,5};
could anyone know the reason why 2nd combination failed?