Can anyone help me understand how Serial.readString() works.
So assuming a very long data is coming in lets say 100 characters worth of serial data. if I call readstring() while the data is still coming in let say i called readstring() on the 10th character. would readstring() immediately return with the 10 character in the buffer? or it would wait presumably until timeout for the rest of characters?
uart has some sort of a stop byte right? so the moment readstring() detects that stopbyte it immediatly returns?
Yes, it will wait, but only for 1000ms. If nothing has arrived, it stops waiting and returns the string it has read (which might be empty). As long as it receives at least one character every 1000ms it will continue waiting.
You can set the timeout period with Serial.setTimeout().
does uart has some of stop bit? that signifies the data coming in has ended? so that readstring() will immediately return and not wait the full 1 seconds?
The stop bit is a per-character item.
Every single character sent over serial has one, and indicates to the UART a return of the line to an idle state.