2013-12-29 23:49:27 +00:00
|
|
|
const unsigned int BAUD_RATE = 9600;
|
2013-12-29 23:58:45 +00:00
|
|
|
unsigned int keys = 0;
|
2013-12-29 23:49:27 +00:00
|
|
|
|
|
|
|
void setup() {
|
2013-12-29 23:58:45 +00:00
|
|
|
Serial.begin(BAUD_RATE);
|
|
|
|
Serial.print("> ");
|
2013-12-29 23:49:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2013-12-29 23:58:45 +00:00
|
|
|
if (Serial.available() <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
2013-12-29 23:49:27 +00:00
|
|
|
|
2013-12-29 23:58:45 +00:00
|
|
|
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("> ");
|
2013-12-29 23:49:27 +00:00
|
|
|
}
|