-
Notifications
You must be signed in to change notification settings - Fork 168
Open
Description
Has anyone tried using this library on the Uno R4 board? I attempted to use the code below, but the data obtained was very unstable and the serial monitor kept printing 1. Although there was a response when pressing the button, it cannot be used for practical applications on the R4 board.
// Include the Keypad library
#include <Keypad.h>
// Define the number of rows and columns in the keypad
const byte ROWS = 4;
const byte COLS = 4;
// Define the keys on the keypad
char keys[ROWS][COLS] = {
{ '1', '2', '3', 'A' },
{ '4', '5', '6', 'B' },
{ '7', '8', '9', 'C' },
{ '*', '0', '#', 'D' }
};
// Define the pins connected to the rows and columns of the keypad
byte rowPins[ROWS] = { 9, 8, 7, 6 };
byte colPins[COLS] = { 5, 4, 3, 2 };
//Create an object of keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
}
void loop() {
char key = keypad.getKey(); // Read the key
// If a key is pressed, print the key on the serial monitor
if (key) {
Serial.print("Key Pressed : ");
Serial.println(key);
}
}
Metadata
Metadata
Assignees
Labels
No labels
