I need some help, I'm trying to use a 4x4 keypad, but something strange happens.
Here is my code
#include <Keypad.h>
#define ROWS 4
#define COLS 4
const char kp4x4Keys[ROWS][COLS] = {{'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'}};
byte rowKp4x4Pin [4] = {9, 8, 7, 6};
byte colKp4x4Pin [4] = {5, 4, 3, 2};
Keypad kp4x4 = Keypad(makeKeymap(kp4x4Keys), rowKp4x4Pin, colKp4x4Pin, ROWS, COLS);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initialize System");
}
void loop() {
readKp4x4();
}
void readKp4x4() {
char customKey = kp4x4.getKey();
if (customKey) {
Serial.println(customKey);
}
}
When I connect pin 9, 8, 7 or 6, I got in the serial monitor, an infinite loop which print respectively 1, 4, 7 or *, depending the pin I connected.
What's wrong with my code ?
Thanks for your help.
i would check this keypad if it work proper with DMM.
and such problem i would examine on breadboard without keypad, but with one simple wire or tactile buttons.
In cores based on the ArduinoCore-API pin modes are defined as enums instead of macros.
Furthermore, I don't think the Giga core emulates AVR's INPUT+HIGH = PULLUP.