Hi,
I try to read from an USB port using AsyncStreamsText; but a strange error occurs.
The relevant code =
BStream and ss have to do with another source.
After a while I get in the log Error occurred on line: 49 (main).
line 49 Reads: StartMessageLoop
What am I doing wrong?
Harry
I try to read from an USB port using AsyncStreamsText; but a strange error occurs.
The relevant code =
B4X:
Sub Process_Globals
Dim sp As Serial
Dim AStream As AsyncStreamsText
Dim BStream As AsyncStreamsText
Dim ss As ServerSocket
Dim cs As Socket
Type tablestruct ( year As Int, month As Int, day As Int, gasconsumption As Long, elecconsumption As Long)
Dim table(24) As tablestruct
End Sub
Sub AppStart (Args() As String)
Dim i As Int
sp.initialize("aStream")
Log(sp.ListPorts)
sp.Open("/dev/ttyUSB0")
sp.SetParams(9600,8,1,0)
For i=0 To 23
table(i).Initialize
Next
AStream.Initialize(Me, "aStream",sp.GetInputStream,sp.GetOutputStream)
ss.Initialize(40000,"ss")
StartMessageLoop
End Sub
Sub aStream_NewText (Text As String)
Log(Text)
End Sub
BStream and ss have to do with another source.
After a while I get in the log Error occurred on line: 49 (main).
line 49 Reads: StartMessageLoop
What am I doing wrong?
Harry