#include "Keypad_by_Murri.h";
byte colPins[] = {5, 4, 3, 2}; // Pins connected to C1, C2, C3, C4
byte rowPins[] = {9, 8, 7, 6}; // Pins connected to R1, R2, R3, R4
Keypad Keypad(rowPins, colPins, 25, 500, 25);
void setup() {
Serial.begin(115200);
}
void loop() {
unsigned long t1 = micros();
Keypad.update();
t1 = micros() - t1;
unsigned long t2 = micros();
Keypad.handle();
t2 = micros() - t2;
if (Keypad.counter) {
printBits(Keypad.counter);
Serial.print("\t" + String(t1) + "\t" + String(t2) + "\n");
}
}
void printBits(uint16_t value) {
for (int i = 15; i >= 0; i--) {
Serial.print(bitRead(value, i));
if (i == 8) Serial.print(' ');
}
// Serial.println();
}