Beja Expert Licensed User Longtime User Jan 2, 2017 #1 Hi All, For a reason I can't test this code, but I am not sure if it will work or not.. please help with anything you note it's not right with the code so I can change it before trying it next week when my BT device works. As you can see the sub will send string array to the BT device, that basically is a command packet to operate a machine. Best regards and thanks in advance. Code: Copy Sub SendStringArray_Click Dim SSA() Array AS String = "68, 123, 66, 84,127,255,0,0" AStream.Write(SSA) End Sub Last edited: Jan 2, 2017
Hi All, For a reason I can't test this code, but I am not sure if it will work or not.. please help with anything you note it's not right with the code so I can change it before trying it next week when my BT device works. As you can see the sub will send string array to the BT device, that basically is a command packet to operate a machine. Best regards and thanks in advance. Code: Copy Sub SendStringArray_Click Dim SSA() Array AS String = "68, 123, 66, 84,127,255,0,0" AStream.Write(SSA) End Sub
Erel B4X founder Staff member Licensed User Longtime User Jan 2, 2017 #2 You need to convert the string to an array of bytes: Code: Copy Dim SSA As String = "68, 123, ..." AStream.Write(SSA.GetBytes("ASCII")) If you want to send those byte values: Code: Copy Dim SSA() As Byte = Array As Byte(68, 123, ...) AStream.Write(SSA) Upvote 0
You need to convert the string to an array of bytes: Code: Copy Dim SSA As String = "68, 123, ..." AStream.Write(SSA.GetBytes("ASCII")) If you want to send those byte values: Code: Copy Dim SSA() As Byte = Array As Byte(68, 123, ...) AStream.Write(SSA)
Beja Expert Licensed User Longtime User Jan 2, 2017 #3 Thanks Erel. That's exactly what I wanted. Upvote 0