// by Ido Gendel, 2021 // For the Arduino Micro #include #define MAX_WAIT 25U #define BUFFER_SIZE 1000U char data[BUFFER_SIZE]; uint16_t bufIndex = 0; uint32_t stamp = 0; void setup() { Serial1.begin(57600); Serial.begin(115200); // For debugging Keyboard.begin(); stamp = millis(); } void loop() { char c; while (0 == Serial1.available()) { if (bufIndex && (millis() - stamp >= MAX_WAIT)) { data[bufIndex] = 13; data[bufIndex+1] = 10; data[bufIndex+2] = 0; Keyboard.print(data); bufIndex = 0; } } while (Serial1.available()) { c = Serial1.read(); // Serial.println((byte)c); // For debugging if (c > 31) { data[bufIndex++] = c; } stamp = millis(); } }