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() &gt; 0) {
        int i = 0;
        delay(500);
        int size = Serial.available();
        while (i &lt; size)
            buffer[i++] = Serial.read();

        Serial.print(buffer);
        //delay(500);
        int j = 0;
        while (j &lt; size)
            buffer[j++] = '\0';
        //while (Serial.available()) Serial.read(); I tried it
        //Serial.flush();   Also tried it, but nothing.             
    }
}
Instead of blocking the loop for 500&nbsp;ms, you should be actively
reading the data as it comes. Otherwise the internal buffer of the
Serial object will overflow after only 64&nbsp;bytes are received.

Here is an example that copies the incoming bytes into a larger buffer
(256&nbsp;bytes) and, upon receiving an end-of-line character, echoes
back the whole line.

void loop() {
    static char buffer[256];
    static size_t pos;              // position of next write

    while (Serial.available() &amp;&amp; pos &lt; sizeof buffer - 1) {

        // Read incoming byte.
        char c = Serial.read();
        buffer[pos++] = c;

        // Echo received message.
        if (c == '\n') {            // \n means "end of message"
            buffer[pos] = '\0';     // terminate the buffer
            Serial.print(buffer);   // send echo
            pos = 0;                // reset to start of buffer
        }
    }
}