hi everyone
ive been fighting with this issue on and off for the last 3 weeks. im trying to send bytes from a pic microcontroller.
im using the bluetooth chat example. if i use it in non prefix mode, i receive the bytes/text, although its all broken up. heres the non-prefix code
of course, the solution is to use the prefix mode, and this is what im trying, unmodified from the bluetooth chat;
the app crashes after connection, which leads me to beleive that im sending the wrong prefix info, from the microcontroller.
here is what im trying to send;4 bytes only. all variables are bytes;
prefix1 = 4
prefix2 = 4
prefix3 = 4
prefix4 = 4 ;;these are the prefix bytes
data1 = 34
data2 = 65
data3 = 232
data4 = 45 ;;;this is the data i need.
here's my microcontroller output, as displayed by the asynchstream with no prefix ;
4444346523245
this is all out of order, and broken up, although its arriving, so hardware bluetooth is ok.
ive gone over all messages pertaining to prefix mode in this forum , but still cannot come up with a solution. prefix mode still keeps on crashing.
any help will be appreciated, and i can change the bytes from the microcontroller.
thanks
ive been fighting with this issue on and off for the last 3 weeks. im trying to send bytes from a pic microcontroller.
im using the bluetooth chat example. if i use it in non prefix mode, i receive the bytes/text, although its all broken up. heres the non-prefix code
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If AStream.IsInitialized = False Then
AStream.Initialize(Main.serial1.InputStream, Main.serial1.OutputStream, "AStream")
End If
txtLog.Width = 100%x
End Sub
of course, the solution is to use the prefix mode, and this is what im trying, unmodified from the bluetooth chat;
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
If AStream.IsInitialized = False Then
AStream.InitializePrefix(Main.serial1.InputStream, true, Main.serial1.OutputStream, "AStream")
End If
txtLog.Width = 100%x
End Sub
the app crashes after connection, which leads me to beleive that im sending the wrong prefix info, from the microcontroller.
here is what im trying to send;4 bytes only. all variables are bytes;
prefix1 = 4
prefix2 = 4
prefix3 = 4
prefix4 = 4 ;;these are the prefix bytes
data1 = 34
data2 = 65
data3 = 232
data4 = 45 ;;;this is the data i need.
here's my microcontroller output, as displayed by the asynchstream with no prefix ;
4444346523245
this is all out of order, and broken up, although its arriving, so hardware bluetooth is ok.
ive gone over all messages pertaining to prefix mode in this forum , but still cannot come up with a solution. prefix mode still keeps on crashing.
any help will be appreciated, and i can change the bytes from the microcontroller.
thanks