Check whether characters are actually available before attempting to read them.
To learn about reliable serial communications, I recommend to spend some time studying the Serial Input Basics tutorial.
Check whether characters are actually available before attempting to read them.
To learn about reliable serial communications, I recommend to spend some time studying the Serial Input Basics tutorial.