Android Question serial communication

tonga

Member
Licensed User
Longtime User
Hi all,
I have a tablet that communicates with a microprocessor by means of a serial line. I want to display the strings coming from the microprocessor on a label, but when they arrive the strings are arranged in a disorderly fashion in the label, while I wish the new strings can erase the previous one and the new text always departed from the top spot in the upper left corner of the label. I started using "UsbSerialDemo." Anyone have any suggestions?
Thank you in advance
 

tonga

Member
Licensed User
Longtime User
Seems like you are creating a new label instead of replacing the existing label text.
Hi Erel,
this is the subroutine activated when the tablet receives something:

Sub Astreams_NewData (Buffer() As Byte)
Dim s As String
s=BytesToString(Buffer, 0, Buffer.Length, "UTF8")
label1.Text=s
End Sub

can you tell me where are the errors?

Thank you
 
Upvote 0

KitCarlson

Active Member
Licensed User
Longtime User
In the non prefix mode, the data may arrive in parts, it is necessary to combine, then set to label when complete. To know when complete, an end marker is often used. Perhaps the AsyncStreams Text, will work better. Erel has a tutorial on that.
 
Upvote 0
Top