Trying to get a 4x4 keypad working.
I'm just wanting to make sure on the nano if D3 thru D10 is the same as assigning them as 6 thru 13
example:
byte rowPins[ROWS] = {6,7,8,9}; //connect to the row R1-R4 pinouts of the keypad
byte colPins[COLS] = {10,11,12,13}; //connect to the column C1-C4 pinouts of the keypad
I have used example codes and cannot get the keystrokes to register
my entire example code i'm trying
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {
{'1','2','3','a'},
{'4','5','6','b'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {6,7,8,9}; //connect to the row R1-R4 pinouts of the keypad
byte colPins[COLS] = {10,11,12,13}; //connect to the column C1-C3 pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
char array1[]{"Enter LED: "};
String pad;
void setup() {
// put your setup code here, to run once:
lcd.begin();
lcd.blink();
//lcd.print(array1);
}
void loop() {
// put your main code here, to run repeatedly:
bacaKeypad();
lcd.setCursor(0,0);
lcd.print(pad);
delay(100);
}
void bacaKeypad() {
char keypressed = keypad.getKey(); //deteksi penekanan keypad
String konv = String(keypressed);
pad+=konv;
}