Hello, I have been trying to publish some messages to my MQTT broker which is running in the same network as the Argon. However, when I flash the sample MQTT example (modified with my ip address), the Argon flashes green for a few seconds and then it just goes black. No lights or flashing at all.
Any help getting MQTT running on any of the mesh devices will be greatly appreciated.
I have not, but you could try flashing the test client that I posted recently to the Argon. You don't need to make any changes to the code. Just flash and go to the Particle Console where you can enter the broker's IP address (or DNS name), a topic and message to publish and/or a topic to subscribe to.
I flashed it to my Argon, and it worked just fine …
To test, I opened a terminal on a Linux machine and typed “mosquitto_sub -t test-topic” to subscribe to “test-topic”
in SetBrokerIP: I entered my broker’s IP address, and clicked CALL
In SetPubTopic: I entered “test-topic” (without the quotes), and I clicked CALL
In Retain?: I entered F and clicked CALL
In Publish-Msg: I entered some text and clicked CALL and the text appeared in the Linux terminal.
To test the other way …
In Subscribe: I entered “another-topic” (without the quotes) and clicked CALL
I then opened a second Linux terminal and typed “mosquitto_pub -t another-topic -m another-message”
In GetMessage, I clicked GET, and “another-message” was displayed
@Bear, you are absolutely right!! I just tested your code and works fine. However, when I tried the sample code that comes with the MQTT library it does not work. I looked at the code and looks very similar to yours… I will review to make sure what is missing in the sample from the library. Thanks