B4J Question Append CRLF to Buffer

Declan

Well-Known Member
Licensed User
Longtime User
I have the following code that communicates with an Arduino device through the Serial port:
B4X:
Sub btnSend_Click
    If astream.IsInitialized = False Then Return
    If EditText1.Text.Length > 0 Then
        Dim buffer() As Byte
        buffer = EditText1.Text.GetBytes("UTF8")
        buffer = buffer
        astream.Write(buffer)
        EditText1.SelectAll
        Log("Sending: " & EditText1.Text)
    End If
End Sub
This is taken from the exaample:
How do I append a CRLF to the Buffer?
I send a text string "AT$I=10", now I must also send a CLF
 

tzfpg

Active Member
Licensed User
Longtime User
B4X:
 Dim b() As Byte
 Dim s as String = "asdfghqwe" & CRLF
 b = s.GetBytes("UTF8")

you can try the code but I don't know work or not.
 
Upvote 0

Declan

Well-Known Member
Licensed User
Longtime User
Thanks, works.
However, I get the data as follows:
B4X:
0
1
F
B
9
9
8
C
I should receive:
01FB998C
 
Last edited:
Upvote 0
Top