Sub Connect(unused As Byte)
If mqtt.Connect = False Then
Log("trying to connect again")
CallSubPlus("Connect", 1000, 0)
Return
End If
Log("Connected to broker")
mqtt.Subscribe("arduino", 0)
mqtt.Publish2("pc", Array As Byte(1, 2, 3), True)
End Sub
Sub Mqtt_Disconnected
Log("Disconnected")
mqtt.Close
Connect(0)
End Sub
Sub Mqtt_MessageArrived (Topic As String, Payload() As Byte)
Log("Message arrived. Topic=", Topic, " payload: ", Payload)
End Sub