I am using the serial library to read data that sends a pulse oximeter.
The oximeter sends data to 500 byte / second
120 seconds after the following message appears.
The oximeter sends data to 500 byte / second
120 seconds after the following message appears.
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (astreams_newdata)
sending message to waiting queue (astreams_newdata)
....
Ignoring event (too many queued events: astreams_newdata)
B4X:
Sub Serial1_Connected (Success As Boolean)
If Success Then
ToastMessageShow("Conexión oximetro realizada ", False)
astreams.Initialize(Serial1.InputStream,Null,"astreams")
TimerBC.Enabled = True
connectedBC = True
Else
connectedBC = False
TimerBC.Enabled = False
Msgbox(LastException.Message, "Error conectando oximetro.")
End If
End Sub
Sub Astreams_NewData (buffer() As Byte)
dataStream.WriteBytes(buffer,0,buffer.Length-1)
If c1=0 Then tim1=DateTime.Now
c1=c1+ buffer.Length
If c1>2000 Then
tim2=DateTime.Now
tim1=(tim2-tim1)/1000
Log(c1/tim1)
c1=0
End If
End Sub