I try to capture a series of value bluetooth using a model taken in the examples. I just txtlog.text replaced by a conventional chain as txtlog not recognized in service mode.
4 values are requested ( ex: 12.5, 12.7, oui, non ) but I have to send 5 not remain waiting on the last readline.
I enclose the code in default:
Sub Timer1_tick
Dim rvu1 As String
Dim rvu2 As String
Dim recep As String
If connected Then
If TextReader1.Ready Then 'check if there is any data waiting to be read
recep=TextReader1.ReadLine
If IsNumber(recep) Then vu1=recep
recep=TextReader1.ReadLine
If IsNumber(recep) Then vu2=recep
recep=TextReader1.ReadLine
etatChargeBat=recep
recep=TextReader1.ReadLine
etatChargeCib=recep
If vu1>11.7 Then
charge1=100-(100*(12.8-vu1))
charge2=100-(100*(12.8-vu2))
End If
capa1=Round2(charge1,2)
capa2=Round2(charge2,2)
rvu1=Round2(vu1,2)
rvu2=Round2(vu2,2)
etat=rvu1&";"& capa1 &";"&rvu2&";"&capa2&";"& etatChargeBat&";"& etatChargeCib&";"& bat
dl.Send("06xxxxxxxx",etat)
End If
End If
End Sub
4 values are requested ( ex: 12.5, 12.7, oui, non ) but I have to send 5 not remain waiting on the last readline.
I enclose the code in default:
Sub Timer1_tick
Dim rvu1 As String
Dim rvu2 As String
Dim recep As String
If connected Then
If TextReader1.Ready Then 'check if there is any data waiting to be read
recep=TextReader1.ReadLine
If IsNumber(recep) Then vu1=recep
recep=TextReader1.ReadLine
If IsNumber(recep) Then vu2=recep
recep=TextReader1.ReadLine
etatChargeBat=recep
recep=TextReader1.ReadLine
etatChargeCib=recep
If vu1>11.7 Then
charge1=100-(100*(12.8-vu1))
charge2=100-(100*(12.8-vu2))
End If
capa1=Round2(charge1,2)
capa2=Round2(charge2,2)
rvu1=Round2(vu1,2)
rvu2=Round2(vu2,2)
etat=rvu1&";"& capa1 &";"&rvu2&";"&capa2&";"& etatChargeBat&";"& etatChargeCib&";"& bat
dl.Send("06xxxxxxxx",etat)
End If
End If
End Sub