1
I have this line of code, and in it I have 2 methods, where one sets up the keypad and another takes the key pressed.
void Maleta::setKeypad(int r1, int r2, int r3, int r4, int c1, int c2, int c3, int c4){
const byte numRows= 4; // Numero de linhas
const byte numCols= 4; // Numero de colunas
char keymap[numRows][numCols]=
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
byte rowPins[numRows] = {r1,r2,r3,r4}; // Pinos digitais onde as linhas estao conectadas
byte colPins[numCols] = {c1,c2,c3,c4}; // Pinos digitais onde as colunas estao conectadas
Keypad myKeypad = Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
}
char Maleta::getKeyPress(){
char keypressed = myKeypad.getKey();
return keypressed;
}
This is the error that returns:
C: Users Luca Documents Arduino Briefcase Briefcase Briefcase.cpp: In Member Function 'char Briefcase::getKeyPress()':
C: Users Luca Documents Arduino Briefcase Briefcase.cpp:32:21: error: 'myKeypad' was not declared in this Scope
char keypressed = myKeypad.getKey();