0

Brightscript issues



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.

4 comments

  • 0
    Avatar
    RokuLyndon


    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
  • 0
    Avatar
    scidude


    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.
  • 0
    Avatar
    Salvatba


    Hi,

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

    Thanks
  • 0
    Avatar
    RokuLyndon


    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.
Please sign in to leave a comment.