On January 24, 2009 at 19:38, Lyndel McGee said...
Why confuse everything with hex markup? The answer to
the simplest solution is in the ASCII translation of the
data.
Send
30h 30h 76h 50h 4Bh 0Dh is in ASCII "00vPK\r"
Receive
30h 30h 76h 50h 4Bh 31h 0Dh is in ASCII "00vPK1\r"
One line will send and get response.
var str = serial.match("00vPK\r","\r",200);
Then use substring to strip off what you don't need.
var sResult = str.substring(5,1); // leaves you with a
string of "1" or likely "0" if unit is not ready.
Got ya.. is the 200 a time out in ms?