How does Serial.readString() manage the serial buffer?

I am not sure if you are asking about how to use the available functions to read data immediately as it arrives or if you want to explore the details of the operation done by the Processing Serial library. If it is the second, you can always explore the source code available in Github. You can study the SerialEvent() as it shows how the handling of streaming data is done.

The part you will need to understand is mainly within the body of that specific function. However, before you go into this part of the source code, you need to understand readStringUntil() as in when to use it and how to use it with the available functions.

A challenge for you, if you are interested, is to use a Thread to simulate incoming serial data.

Kf

2 Likes