Hi all,
I am just a one week newbie. My first try is working with jMQTT.
My application dialog with an Arduino broker via Wifi. The Arduino is connected by Nrf24L01 to 3 sensors.
I have no problem with subcribed message.
If I try to publish... it seem not working.
The topic is MyMQTT/21/1/V_LIGHT and the payload must be "0" or "1".
For information I have other application working with this Arduino broker.
Here is the code for publishing.
Any help welcome.
I am just a one week newbie. My first try is working with jMQTT.
My application dialog with an Arduino broker via Wifi. The Arduino is connected by Nrf24L01 to 3 sensors.
I have no problem with subcribed message.
If I try to publish... it seem not working.
The topic is MyMQTT/21/1/V_LIGHT and the payload must be "0" or "1".
For information I have other application working with this Arduino broker.
Here is the code for publishing.
Any help welcome.
B4X:
Sub tbnLight_CheckedChange(Checked As Boolean)
Dim msg(1) As Byte
Select tbnLight.Checked
Case True
msg(0) = 0x31
Case False
msg(0) = 0x30
End Select
Log("Sent Payload: " & BytesToString(msg, 0, msg.Length, "utf8"))
Try
mqtt.Publish("MyMQTT/21/1/V_LIGHT",msg)
Catch
Log(LastException)
If mqtt.Connected = False Then
mqtt.Connect
End If
End Try
End Sub