#include <I2CKeyPad.h>
#define deltaTime(val) (millis()-val)
I2CKeyPad keyPad(0x38);
char lowerCase[52] = "`1234567890-=8qwertyuiop[]\\\0asdfghjkl;'\n\014zxcvbnm./\0\0";
// N = NO_KEY, F = FAILED
// Just to avoid spamming
unsigned long lastKeyPress = 0;
unsigned long keyDelay = 200;
void setup() {
Serial.begin(9600);
if (!keyPad.begin()) {
Serial.print("Cannot connect to I2C.\n");
while(1);
}
keyPad.loadKeyMap(lowerCase);
}
void loop() {
if (keyPad.isPressed() && deltaTime(lastKeyPress) > keyDelay) {
lastKeyPress = millis();
char ch = keyPad.getChar();
Serial.println("Pressed : " + String(ch));
}
// Makes the code run faster
delay(10);
}
FPS: 0
Power: 0.00W
Power: 0.00W