Post 14 made on Wednesday September 15, 2010 at 20:54 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 13,007 |
|
|
\r (just like in C/C++) is Carriage Return.
You need to remove the extra space in " " such that your command looks like:
label = s.match("", "\r", 2000);
What this line does is wait up to 2 seconds to receive a line of text from the serial port. The empty string (same as null) in the first parameter sends nothing and therefore this match operation only does receive with timeout of 2 seconds. I highly recommend reading Appendix A or B of the Dev Guide that discusses each of these functions based on the ProntoScript object type. If it is not in an appendix, there should be a dedicated section in the guide for these. I can't recall if they removed the appendix in the latest dev guide but it was there in previous releases and was invaluable.
Assuming that you get a string (the extender saw a string ending in \r within 2 seconds), the variable label will contain the string received provided that you have not assigned an onData and onTimeout functions (asynchronous serial port usage).
|
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|