Hang at Serial1.readString ()


I tried to get input from Serial1 with the following code:


Serial1 has data available. But the code hang at Serial1.readString(), but read() works.

What’s wrong?

Serial1.readString() waits for up to Serial1.setTimeout() (default 3000) milliseconds for a new input.
Each time you send a new byte this timeout starts anew.
You could also use Serial1.readStringUntil() if your strings get commited via a particlular character (e.g. \n).

1 Like