Hi
I have some issues using the Asyncstreams,
Also caused by the fact im very new to this..
But neverteless I cant get my situation working..
I want to receive the following sentences from an embedded device.
Header = $
Stopper = #
Variable = 1234
$1234#
I have made a similar code for my embedded work, and that works fine..
This is what i made with Astreams_newdata.
I looks like I am missing a lot of characters sended in..
What I want is full control over all the characters 1 by 1 coming in, without missing some.
:sign0163:
Verstuurd van mijn LT18i met Tapatalk
I have some issues using the Asyncstreams,
Also caused by the fact im very new to this..
But neverteless I cant get my situation working..
I want to receive the following sentences from an embedded device.
Header = $
Stopper = #
Variable = 1234
$1234#
I have made a similar code for my embedded work, and that works fine..
This is what i made with Astreams_newdata.
I looks like I am missing a lot of characters sended in..
What I want is full control over all the characters 1 by 1 coming in, without missing some.
:sign0163:
B4X:
Sub AStreams_NewData (D() As Byte)
Dd = BytesToString(D,0,1,"UTF-8")
Dim Bytecounter As Byte
Dim Cmaxchar As Byte :Cmaxchar = 20
Dim Buffer As String
Dim Dd As String
If Connected Then
If Bytecounter < Cmaxchar Then
Bytecounter = Bytecounter + 1
If Dd = "#" Then
Buffer = ""
Bytecounter = 0
Label1.Text = Buffer
Else If Dd = "$" Then
Buffer= ""
Bytecounter = 0
Else
Buffer = Buffer & Dd
If Bytecounter > 19 Then
Buffer = ""
Bytecounter = 0
End If
End If
End If
End If
End Sub
Verstuurd van mijn LT18i met Tapatalk
Attachments
Last edited: