B4R Question MQTT Arrived text message from B4A cannot be decoded by B4R

Jan Kanon PA7X

Licensed User
Longtime User
Hi All,

Almost finalizing my project i have a problem decoding the text message send from Android (B4A code) by MQTT to Arduino (B4R code)

My Arduino receiving code is :

Sub MQTT_MessageArrived (Topic As String, Payload() As Byte)
Dim BC As ByteConverter
Log("Topic = ", Topic, " and Payload = ", BC.StringFromBytes(Payload))
End Sub

My Android sending code is :

Sub ButtonLeft_Touch(Action As Int, X As Float, Y As Float)
Select Action
Case Activity.ACTION_DOWN
lblStatus.Text = "Draaien naar Links"
CallSub2(Starter, "SendMessage", "TLEFT")
Case Activity.ACTION_UP
lblStatus.Text = "Stop draaien naar Links"
CallSub2(Starter, "SendMessage", "SLEFT")
End Select
End Sub

Result in log after touching left button is :

Topic = SmartMove and Payload = x�cde``�qu

Topic = SmartMove and Payload = x�cde``�qu

To process further i need the values TLEFT and SLEFT

Any advices /solutions ?

Best regards, Jan

Johan Hormaza

Well-Known Member
Licensed User
Longtime User

Use the code style to facilitate and make it faster
Upvote 0