Files

28 lines
488 B
Arduino
Raw Permalink Normal View History

2023-03-17 11:59:21 +00:00
#include <Chatpad.h>
Chatpad pad;
void print_keys(Chatpad &pad, Chatpad::keycode_t code,
Chatpad::eventtype_t type) {
if (type == Chatpad::Down) {
char a = pad.toAscii(code);
if (a =='\t'){
Serial.println("Pressed right");
}else if(a=='\v'){
Serial.println("Pressed left");
} else if (a != 0){
Serial.print(a);
}
}
}
void setup() {
delay(1000);
Serial.begin(57600);
pad.init(Serial1, print_keys);
}
void loop() {
pad.poll();
}