if loops and numbers and serin :/
trend
Posts: 112
What is the currect way of getting numbers from the computer (via hyperterm or visual basic6)?
I have been:
·· serin 16, baud, [noparse][[/noparse]number]
···if number = "13" then debug "works"
but then I get a compile error.. "expected 'then'"
I could always do:
·· serin 16, baud, [noparse][[/noparse]number]
···if number = 13 then debug "works"
but then.. 13 doesn't equal "13".. so the if loop doesn't get completed
any ideas?
thanks-Lee
Post Edited (trend) : 12/5/2004 11:47:15 AM GMT
I have been:
·· serin 16, baud, [noparse][[/noparse]number]
···if number = "13" then debug "works"
but then I get a compile error.. "expected 'then'"
I could always do:
·· serin 16, baud, [noparse][[/noparse]number]
···if number = 13 then debug "works"
but then.. 13 doesn't equal "13".. so the if loop doesn't get completed
any ideas?
thanks-Lee
Post Edited (trend) : 12/5/2004 11:47:15 AM GMT
Comments
SERIN 16, baud, [noparse][[/noparse]number]
will recieve a single byte. If you sent it a CR character (Ctrl-J? Ctrl-M? one of those two) then the compare
IF number = 13 THEN Debug "Got it"
should work.
You COULD do:
SERIN 16, baud [noparse][[/noparse]DEC number]
THEN send it the three characters '1', '3', CR.
I believe this would put the value '13' into 'number', with the 'DEC' parsing your sent two characters into the value.