Arduino can only read from serial one character at a time

Robin2:
Why is my stuff "nonsense"?

My code provides an indicator when something is received.

I am not saying mine is the only way to do it - but I don't think it is fundamentally different to yours. And my code was written to work with the Arduino functions that less experienced users are likely to be familiar with.

...R

In the context of your tutorial, it is great. The approach is yours and I tried to stay as close to your tutorial as possible. However, in the context of this program, the function names are meaningless and they don't indicate in any way that there are dependancies. In your tutorial it's fine because there is nothing else happening.

Again, as I've mentioned, you stopped short of taking the tutorial all the way through the basics of functional programming. I feel that folks would benefit greatly by paying attention for one more module. They's leave way more prepared (i.e. this post).

sterretje:
Although I prefer to test the newData flag in loop(), I agree that Robin's code works because it checks the flag in the printNwData() function.

Of course its your prerogative, but why not tell the story as you write the code?

  if (thisHappens(toThis))
 {
    doThis();
  }