Skip to main content
edited tags
Link
Nick Gammon
  • 38.7k
  • 13
  • 67
  • 125
Post Migrated Here from stackoverflow.com (revisions)
Source Link
Robert
  • 159
  • 1
  • 3
  • 11

How do I receive more that 64 bytes with Arduino

I am using QtSerialPort to send and receive data from Arduino. I am sending more than 64 bytes (125, 220, more), I receive the data with Arduino, and trying to sending back the same data, but Arduino sending only 64 bytes in its response. Then I am thinking that the problem is with Arduino buffer. I am trying to clear the data but without result.

Here is my Arduino code:

void loop() {    
    if (Serial.available() > 0) {
        int i = 0;
        delay(500);
        int size = Serial.available();
        while (i < size)
            buffer[i++] = Serial.read();

        Serial.print(buffer);
        //delay(500);
        int j = 0;
        while (j < size)
            buffer[j++] = '\0';
        //while (Serial.available()) Serial.read(); I tried it
        //Serial.flush();   Also tried it, but nothing.             
    }
}