const unsigned int BAUD_RATE = 9600; unsigned int keys = 0; void setup() { Serial.begin(BAUD_RATE); Serial.print("> "); } void loop() { if (Serial.available() <= 0) { return; } Serial.write(Serial.read()); keys++; if (keys == 100) { Serial.println("\nKABOOM!!!"); keys = 0; Serial.print("> "); return; } Serial.println(""); Serial.print(keys); Serial.println(" keys pressed"); Serial.print("> "); }