Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Keypad.h>
- const byte qtdLinhas = 4;
- const byte qtdColunas = 4;
- char matriz_teclas[qtdLinhas][qtdColunas] = {
- {'1', '2', '3', 'A'},
- {'4', '5', '6', 'B'},
- {'7', '8', '9', 'C'},
- {'*', '0', '#', 'D'}
- };
- byte PinosqtdLinhas[qtdLinhas] = {9, 8, 7, 6};
- byte PinosqtdColunas[qtdColunas] = {5, 4, 3, 2};
- Keypad meuteclado = Keypad(makeKeymap(matriz_teclas), PinosqtdLinhas, PinosqtdColunas, qtdLinhas, qtdColunas);
- void setup() {
- Serial.begin(9600);
- Serial.println("Aperte uma tecla...\n");
- }
- void loop() {
- char tecla_pressionada = meuteclado.getKey();
- if (tecla_pressionada) {
- Serial.print("Tecla pressionada: ");
- Serial.println(tecla_pressionada);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement