Your Digital Media Has Never Looked So Good

 
scidude
Topic Author
Posts: 13
Joined: Thu Jan 08, 2009 1:07 pm

Brightscript issues

Wed Jun 24, 2009 12:32 pm

Hey Folks,
I'm trying to use the roSerialPort object and I don't seem to be able to find the syntax for actually determining what byte I've received. I can test for the event type no problem (if serial event then turn on light....) but I don't seem to find any syntax which allows me to determine what character I've actually received. For video object message (for example) I can perform a "GetInt()" and determine the video message number (8 for finished...that sort of thing). What syntax do I use to "Get" the ascii character once it's been received? Any help would be awesome..thanks in advance.
 
RokuLyndon

Wed Jun 24, 2009 3:03 pm

You can just look at the the message itself. And, if you are receiving bytes and not strings, be sure to use SetByteEventPort(p) vs SetLineEventPort(p)

For example:

msg = wait(0,p)
if type(msg) = "roStreamByteEvent" then
if msg = &H0D then print "carriage return received."

endif
 
scidude
Topic Author
Posts: 13
Joined: Thu Jan 08, 2009 1:07 pm

"get" function for roserialport

Thu Jun 25, 2009 5:36 am

Aaaaahhhhh....thank you Lyndon. That worked like a charm. The hint of using a hex value and not ascii in quotes is what did it.
 
Salvatba
Posts: 3
Joined: Tue May 11, 2010 5:46 am
Location: Madrid
Contact:

Re: Brightscript issues

Thu May 13, 2010 4:12 am

Hi,

For UDP received strings, we would do the same in order to catch everything to last hexadecimal 0D?

Thanks
 
RokuLyndon

Re: Brightscript issues

Thu May 13, 2010 6:11 am

UDP only receives strings, and it doesn't require a carriage return. You could take in the string, and then check if the last character was a carriage return.

Who is online

Users browsing this forum: No registered users and 1 guest