Hi All,
I am trying to send a few bytes to a Bluetooth device to control a machine. But these bytes must change according to the intended function be executed.
I put the code in timer1_Tick but I know this is not the right place. I understand that the array variable (see code below) should be outside the timer1_tick
but didn't know how to do that.
I am trying to send a few bytes to a Bluetooth device to control a machine. But these bytes must change according to the intended function be executed.
I put the code in timer1_Tick but I know this is not the right place. I understand that the array variable (see code below) should be outside the timer1_tick
but didn't know how to do that.
B4X:
lang="b4x" title="Byte array variable"]
'arry1: 75, 28, 82, 158, 127, 0, 1, 29
'array2: 83, 68, 82, 95, 127, 0, 0, 222
'arry3: 11, 22, 87, 127, 158, 0, 1, 29
'arry4: 59, 32, 82, 23, 95, 0, 65, 222
'array5: 57, 68, 54, 127, 127, 0, 0, 254
Sub Timer1_Tick
If connected Then
Dim a() As Byte = Array As Byte(75, 28, 82, 158, 127, 0, 1, 29)
Dim out As OutputStream
out = Serial1.OutputStream
out.WriteBytes( a, 0, a.Length)
out.Flush
End If
End Sub