I'm using a 4x3 membrane keypad and Arduino UNO R4 Wifi to test my keypad.
My R1-R4 was plugged into 7~10 and C1-C3 was plugged into 4~6
here is my code to test it
/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>
const static int ROWS = 4, COLS = 3;
static char KEYPAD[4][3] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
// NOTE: Change the pins if physical pins are changed
static byte rowPins[ROWS] = {10,9,8,7};
static byte colPins[COLS] = {6,5,4};
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(KEYPAD), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
}
However, since it start running,a bunch of random number just output in the serial and I even didn't press anything.
I try to pressed 1 and output is 777777777777777100000000000
what could the problem be? Does the membrane keypad requires a insulated platform?
I used your code in the simulator and it worked normally.
The simulator only has a 4x4 keyboard, but since I didn't use the fourth column, it's the same as your 4x3.
Check if there is any wrong connection or bad contact in the connections.