merlin2049er Well-Known Member Licensed User Longtime User Aug 25, 2013 #1 I've got this code I'm using to write data to my arduino - it works fine... Everything else, connecting, initializing bt, works... I'm using the same code to send streams now to another android device Code: Copy Sub SendData(data As String) 'send data to your android device If data.Trim <> "" Then Log(data) AStream.Write(data.GetBytes("UTF8")) End If End Sub On the receiving side? Not clear on how to read this stream, and make use of it.
I've got this code I'm using to write data to my arduino - it works fine... Everything else, connecting, initializing bt, works... I'm using the same code to send streams now to another android device Code: Copy Sub SendData(data As String) 'send data to your android device If data.Trim <> "" Then Log(data) AStream.Write(data.GetBytes("UTF8")) End If End Sub On the receiving side? Not clear on how to read this stream, and make use of it.
Erel B4X founder Staff member Licensed User Longtime User Aug 25, 2013 #2 You should handle the AStream_NewData event. Upvote 0
merlin2049er Well-Known Member Licensed User Longtime User Aug 25, 2013 #3 Can you bring the buffer as a string or do u need to do it a byte at a time? Is this possible... sub Astream_NewData(buffer () as string) do stuff here... End sub Upvote 0
Can you bring the buffer as a string or do u need to do it a byte at a time? Is this possible... sub Astream_NewData(buffer () as string) do stuff here... End sub
Erel B4X founder Staff member Licensed User Longtime User Aug 25, 2013 #4 You cannot change the event signature. However it is very simple to convert an array of bytes to a string with BytesToString keyword. I recommend you to go over AsyncStreams tutorial. You might want to use AsyncStreamsText class. Upvote 0
You cannot change the event signature. However it is very simple to convert an array of bytes to a string with BytesToString keyword. I recommend you to go over AsyncStreams tutorial. You might want to use AsyncStreamsText class.