void readSerialString () {
while(Serial.available() > 0) // will do until gets full line
{
int iBuffer = Serial.read(); // if something comes in save it
if(iBuffer == '.')
break; // but we may never get here!
cString[iBufferIndex] = iBuffer; // add it to string
iBufferIndex++;
cString[iBufferIndex]= '\0'; // make sure our last element is nothing
Serial.print( iBuffer , BYTE); // echo back
//delay(5); // for whatever reason, Arduino needs this or read doesn't finish
}
}
Thanks! Can you explain why the sketch works with the delay and not without it?