serialdata = Serial.read(); // Lets read the data from the serial port
delay (500);
You read one character, then wait half a second?
At 9600baud, your 128 byte receive buffer could overflow over three times in that period.
serialdata = Serial.read(); // Lets read the data from the serial port
delay (500);
You read one character, then wait half a second?
At 9600baud, your 128 byte receive buffer could overflow over three times in that period.