     }
 }
 
+/**
+ * Reads a command from the serial line and executes it-
+ */
 void loop() {
     String line = readCommand(Serial);
     processCommand(line, Serial);

}
#endif // RECEIVE

void setup() {
    Serial.begin(BAUDRATE);
    while (!Serial)
        ; // wait for serial port to connect. "Needed for Leonardo only"
    
    Serial.println(F(PROGNAME " " VERSION));
    //Serial.setTimeout(SERIALTIMEOUT);
#ifdef RECEIVE
    // There is unfortunately no disableIRIn in IRremote.
    // Therefore, turn it on, and leave it on.
    // We _hope_ that it will not interfere with sending.
    irRecv.enableIRIn();
#endif
}


static String readCommand(Stream& stream) {
    while (stream.available() == 0) {
    }
    
    String line = stream.readStringUntil(EOLCHAR);
    line.trim();
    return line;


#ifdef RECEIVE
        case 'r': // receive
        //case 'a':
        //case 'c':
            receive(stream);
            break;
#endif // RECEIVE
