Android Question How to make a string variable a byte array?

Beja

Expert
Licensed User
Longtime User
Hi all,
In the following code snippet, I have a byte array with constant values. I want to change the byte array elsewhere so when the next Timrt1_Tick event fires again the sub will send the new values,

B4X:
    If connected Then
        Timer1.Enabled=True
        'Turn Right
        Dim a() As Byte = Array As Byte(83, 68, 82, 158, 127, 0, 1, 29)
        Dim out As OutputStream
        out = Serial1.OutputStream
        out.WriteBytes( a, 0, a.Length)
        out.Flush
    End If

Best regards, B
 
Top