I am using 2 4×4 keypads in unison(the rows are connected) in an attempt to simulate a keyboard.
The issue I’m running into is that it is giving no output on the 3rd row, and is giving the wrong output for every other button. It is supposed to return in this manner:
Pad 1 : Pad 2:
Q | W | E | R T | Y | U | I
O | P | A | S D | F | G | H
J | K | L | Z X | C | V | B
^ | > | _ | M M | _ | < | +
It is however returning in this manner, the blank spaces are the buttons with no output.
Pad 1 : Pad 2:
- | | H | I N | | R | S
< | | G | U _ | | E | A
_ | | F | Y > | | W | P
M | | D | T ^ | | Q | O
Below is the code I am using:
It is a modified version of the CustomKeypad example from the Keypad Library.
/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact [email protected]
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 8; //eight columns
//define the symbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I'},
{'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H'},
{'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B'},
{'^', '>', '_', 'N', 'M', '_', '<', '?'}
};
byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {11, 10, 9, 8, 7, 6, 5, 4}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
}
I have tried switching computers, switching Arduino boards, and switching libraries.
The Adafruit Keypad Library was the exact opposite of my inputs, with the buttons without outputs, giving outputs, and vice versa.
Any help would be greatly appreciated! Thank you in advance!