Public Sub writeData1
'Enable Temperatur und Feuchtresensor
manager.SetNotify("f000aa20-0451-4000-b000-000000000000","f000aa21-0451-4000-b000-000000000000",True)
Log("Set Notify")
Sleep(500)
Dim valoriByte(1) As Byte
valoriByte(0)=0x01
manager.WriteData("f000aa20-0451-4000-b000-000000000000","f000aa22-0451-4000-b000-000000000000",valoriByte)
Log("Set WriteData1")
Sleep(500)
Dim valoriByte(1) As Byte 'Period
valoriByte(0)=0xFF
manager.WriteData("f000aa20-0451-4000-b000-000000000000","f000aa23-0451-4000-b000-000000000000",valoriByte)
Log("Set WriteData2")
Sleep(500)
'Period AA23* R/W 2.55 sec (0xFF). Default 1 second (0x64).
End Sub
Sub Manager_DataAvailable (ServiceId As String, Characteristics As Map)
Private tem As Int
Private hum As Int
Private temp1,temp2,hum1 As Float
Dim ArrayBytes() As Byte = Characteristics.Get("f000aa21-0451-4000-b000-000000000000")
'Dim bc As ByteConverter
'bc.LittleEndian = True
'Dim temp As Float = bc.ShortsFromBytes(Array As Byte(ArrayBytes(0), ArrayBytes(1)))(0)/65536*165-40
'Log(temp)
'Dim temp10 As Float = bc.ShortsFromBytes(Array As Byte(ArrayBytes(2), ArrayBytes(3)))(0)/65536*100
'Log(temp10)
'tem = ArrayBytes(0) + (ArrayBytes(1) * 256)
tem = (ArrayBytes(1)*256) + ArrayBytes(0)
Sleep(500)
'hum = ArrayBytes(2) + (ArrayBytes(3) * 256)
hum = (ArrayBytes(3)*256) + ArrayBytes(2)
temp1 = (tem/65536)*165-40
temp2 = ((temp1*9.0)/5.0)+32.0 ' = Fahrenheit
Log("Temperatur-Grad = " & NumberFormat(temp1, 1, 2))
Log("Temperatur-Fahrenheit = " & NumberFormat(temp2, 1, 2))
hum1 = (hum/65536)*100
Log("Feuchte = " & NumberFormat(hum1, 1, 2))
BlueATemperatur = NumberFormat(temp1, 1, 2) 'Übergabedaten
BlueALuftfeuchtigkeit = NumberFormat(hum1, 1, 2) 'Übergabedaten
'Gefundenen Code----------------------------------------------------------------------------------------
' Calculate the humidity temperature (Celsius).
'var tData = evothings.util.littleEndianToInt16(data, 0)
'var tc = -46.85 + 175.72 / 65536.0 * tData
'' Calculate the relative humidity.
'var hData = (evothings.util.littleEndianToInt16(data, 2) & ~0x03)
'var h = -6.0 + 125.00 / 65536.0 * hData
End Sub