#include "Keypad.h"
#define ROW_NUM 4 // quatro linhas 

#define COLUMN_NUM 4 // quatro colunas 


/*
  char keys[ROW_NUM][COLUMN_NUM] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
}; */

char keys[ROW_NUM][COLUMN_NUM] = { //PROVAVEL ERRO DE FABRICA POR ISSO TEM QUE ESTAR NESSA FORMATAÇÃO
  {'D','#','0','*'},
  {'C','9','8','7'},
  {'B','6','5','4'},
  {'A','3','2','1'}
};

// For ESP32 Microcontroller
 byte pin_rows[ROW_NUM] = {13, 12, 14, 27}; //26, 25, 33, 32
 byte pin_column[COLUMN_NUM] = {26, 25, 33, 32}; //13, 12, 14, 27

     

 Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );

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

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

  if (key){
    Serial.println(key);
  }
}