Contributed by wxlinus, curated by Ai-Thinker
I originally wanted to port an MQTT library. Halfway through the porting, I found that VSCode prompted "mqtt" when writing the calls — it turned out the example already had one. So this is a record of connecting the MQTT in the example to EMQX.
- Download and start EMQX
- Download emqx-5.3.2-windows-amd64.zip and extract it
- Enter the extracted path in the command line and start EMQX
Operation Steps
./emqx/bin/emqx start

EMQX port introduction

Log in to EMQX and configure the MQTT client authorized account Access http://localhost:18083/ (localhost can be replaced with your actual IP address) through a browser to open the EMQX Dashboard management console for device connection and related metric monitoring.
Operation Steps (continued)
Default username and password
Username admin
Password public
The mqtt account configuration will be needed for device-side development later.

Here I configured one:
Operation Steps (continued)
username: test
password: test
It's better to configure one more for publishing/subscribing in the background later.Device-side development
Change the configuration.

Modify the WiFi connection info and mqtt account info; they are hardcoded in the example for now.

Flash and then write

You can see it has connected.

Let’s test the remote light-on ceremony
Publish a turn-on topic (the light is on by default when the board starts, so I turned it off first; otherwise it wouldn’t be a light-on ceremony
)

You can see the serial port received the data and the light turned on.

Done, confetti! ✿✿ヽ(°▽°)ノ✿
Have questions?
For other questions, please visit the unified discussion area: Ai-Thinker Discussions

