#include AbstractKeypad.h
enum KeypadButtons{
UP,DOWN,LEFT,RIGHT,OK,BACK,_COUNT
};
const char BUTTON_CHAR[] = "wsadqe";
AbstractKeypad keypad();
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println(F("Start"));
}
/*
void kSerial(){
if(Serial.available()>0){
char c = Serial.read();
if(c!='\n'){
if(Serial.read()=='\n'){
keypad.triggerKeyPress(c);
Serial.print(F("Trigger Key '"));
Serial.print(c);
Serial.println(F("'"));
}
}
while(Serial.available()) Serial.read();
}
}
*/
void readSerial() {
if (Serial.available() > 0) {
char c = Serial.read();
if (c != NO_KEY) {
if (Serial.read() == '\n') {
keypad.Trigger(c);
}
}
while (Serial.available() > 0) Serial.read();
}
}
void onInput(char c) {
if (c != 0) {
Serial.print(F("Input : "));
Serial.print(c);
Serial.println();
}
}
//
void loop() {
// put your main code here, to run repeatedly:
readSerial();
onInput(keypad.getKey());
delay(100);
}