text as input with keyboard

  Serial.flush();

Block until the outgoing serial buffer is empty, even though you haven't written anything to the buffer. Why?