Shop OBEX P1 Docs P2 Docs Learn Events
.sendbyte() — Parallax Forums

.sendbyte()

darnitdarnit Posts: 25
edited 2006-04-28 16:47 in General Discussion
.sendbyte() seems to only accept an integer value.

such as....

txUart.sendbyte(0xB2)

is there a way for it to use a variable reference, such as

int cmd = 0xB2

txUart.sendbyte(cmd)· or do i have to use

txUart.sendstring()?

I am asking because when i look at the transmit line with an oscope it looks like it takes longer for .sendstring to send the bytes down the line than it takes a series of .sendbyte() statements.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-04-28 16:47
    .sendString() calls .sendByte() for each·byte in the string, and since it must update
    an index counter and test for end of string, it does take slightly longer than a series of
    .sendByte().
    But .sendString() allows to send any contents, whereas with .sendByte() you are
    limited to constants or scalar variables.
    So it is a tradeof between codesize and speed, as usual.

    regards peter
Sign In or Register to comment.