In my program I have these codelines
The first string is printed correctly. But then instead of waiting for character from the terminal window (as I would expect) it keeps printing a garbage token. Why ? How do I get the program to wait and read a character when I send it from the terminal ?
Your expectation of how Serial.read works is not aligned with reality.
If there is nothing to read, it returns -1, your garbage token.
If you want to wait, use Serial.available()
We were actually just talking about this in this thread:
Although this may not be the best way to do things it should work and maybe get you moving along.