B4R Question MQTT - send data as plain text

barx

Well-Known Member
Licensed User
Longtime User
Hi
I'm struggling to figure how to publish data to a broker as plain text (required by another device)
The publish method expects Payload() As Byte. Sending text as a String is therefor ok.

But what about Floats and Ints?

I've wrote this sub to try cast them to String

B4X:
Sub ToString(Obj As Object) As String
    Dim s As String = Obj
    Return s
End Sub

Works ok for Float, but crashes the ESP8266 with Int.

Any tips? I'm it will be something simple that I'm missing.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…