Serial Port receiving buffer size

yeah, not knowing your capabilities, I kind of led you down the garden path there. More like this:

char myEndTXmarker = '#' //for example
if (Serial1.available())
{
  do {
    readByte = Serial1.read();
    risposta[leggi] = readByte;
    leggi++;
    delay(2); //slow it down a bit, allowing your next byte time to arrive
  } while (readByte != myEndTXmarker); /* && leggi < EXPECTED_BUFFER_LENGTH);*/  // if you need to prevent overflow you can add that condition
}

or something close to that may work for you.

1 Like