H Herbert32 Active Member Licensed User Longtime User Jul 18, 2021 #1 Hi together, B4R: how to convert the received content of Payload (array of bytes) , which shows "244" at Log(Payload) within Private Sub MQTT_MessageArrived (Topic As String, Payload() As Byte) Log(Payload) 'shows the expected "244" Dim MyULongVar as ULong how can I do: MyULongVar = ..content_of_Payload().. ????? End Sub
Hi together, B4R: how to convert the received content of Payload (array of bytes) , which shows "244" at Log(Payload) within Private Sub MQTT_MessageArrived (Topic As String, Payload() As Byte) Log(Payload) 'shows the expected "244" Dim MyULongVar as ULong how can I do: MyULongVar = ..content_of_Payload().. ????? End Sub
Erel B4X founder Staff member Licensed User Longtime User Jul 18, 2021 #2 Please use [code]code here...[/code] tags when posting code. What is the output of: B4X: Log(Payload.Length)? Log(Payload(0)) ? Upvote 0
Please use [code]code here...[/code] tags when posting code. What is the output of: B4X: Log(Payload.Length)? Log(Payload(0)) ?
H Herbert32 Active Member Licensed User Longtime User Jul 19, 2021 #3 Hi & thx for your reply, B4X: Log(Payload.length): 3 Log(Payload(0)): 50 I found a way which worked for me by converting Payload to string and then to ULong: B4X: If IsNumber(Payload) = True Then Dim ratio As String ratio = bc.StringFromBytes(Payload) OnTime = ratio Log("OnTime: ",OnTime) End If Upvote 0
Hi & thx for your reply, B4X: Log(Payload.length): 3 Log(Payload(0)): 50 I found a way which worked for me by converting Payload to string and then to ULong: B4X: If IsNumber(Payload) = True Then Dim ratio As String ratio = bc.StringFromBytes(Payload) OnTime = ratio Log("OnTime: ",OnTime) End If