byte cmdlen = 0; void setup() { DDRC = B11111111; DDRB = B11111111; DDRD = B11111110; Serial.begin(9600); PORTC = B00000000; PORTB = B00000000; PORTD = B00000000; } void loop() { ServeConsole(); } void ServeConsole() { static char cmd[16]; while(Serial.available()) { // Read chars from buffer. byte c = Serial.read(); if (cmdlen>=sizeof(cmd)) { Serial.println("Troll detected!"); c = '-'; } Serial.print((char)c); if (c == 10 || c == 13 || c==64) { for (cmdlen=cmdlen; cmdlen