Is it possible (or does it even make sense) for a blocking Serial.read() type of function? I am very new to the arduino and just hacking around with it. What I'm basically trying to do is prompt for a string, block for the input, then print it back out (or something like that.) It appears not to be doing that. It keeps processing the code in the loop() Is there a way to do that? Or is that not even really something that "makes sense" in this context?
It could make sense for some types of application to simply block waiting for serial IO. Serial.available() could be used to achieve blocking. Something like this:
while (Serial.available() == 0)
/* just wait */ ;
/* read the incoming byte
*/
incomingByte = Serial.read();
Thanks, I will give that a try. Does that actually block or does it basically just poll for an available byte before proceeding? It doesn't really matter for what I am trying to do, I am just trying to understand how it is working.