The problem is that the
ArrayBytes = Characteristics.Get("00002a1c-0000-1000-8000-00805f9b34fb")
does not get value int the previously attached project:
Sub DataAvailable (Service As String, Characteristics As Map)
pbReadData.Visible = False
If Service = "00001809-0000-1000-8000-00805f9b34fb" Then 'Thermometer
For i = 0 To Characteristics.Size - 1
For Each id As String In Characteristics.Keys
If id = "00002a1c-0000-1000-8000-00805f9b34fb" Then
Private tem,hum As Int
Private temp1,temp2,hum1 As Float
Dim ArrayBytes() As Byte
Private Zaehler As Int
Private Twert As Int
Private Fwert As Int
Private BlueATemperatur As Int
Private BlueALuftfeuchtigkeit As Int
ArrayBytes = Characteristics.Get("00002a1c-0000-1000-8000-00805f9b34fb") '<- ARRAYBYTES is EMPTY!!!!!!!!
'Convert to Grad and Fahrenheit
tem = Bit.Or(Bit.And(Bit.ShiftLeft(ArrayBytes(1), 8), 0x0000ff00), Bit.And(ArrayBytes(0), 0x000000ff))
hum = Bit.Or(Bit.And(Bit.ShiftLeft(ArrayBytes(3), 8), 0x0000ff00), Bit.And(ArrayBytes(2), 0x000000ff))
temp1 = (tem/65536)*165-40 ' = Grad
temp2 = ((temp1*9.0)/5.0)+32.0 ' = Fahrenheit
Log("Grad = " & NumberFormat(temp1, 1, 2))
Log("Fahrenheit = " & NumberFormat(temp2, 1, 2))
End If
Next
Next
End If
End Sub
Thanks Erel!