01 Overview
Connect, subscribe, publish.
- Use when: telemetry, remote switches.
- Skip when: LAN page only, or BLE only.
- The TCP example is plaintext. Use the SSL example on the public internet.
Reach a server
The usual channel for sensors and remote commands.
Official path: examples/protocols/mqtt/tcp
Connect, subscribe, publish.
1. Wait for GOT_IP.
2. Configure broker and client ID.
3. Subscribe and publish on CONNECTED.
4. Parse payloads on DATA; the official code only logs.
5. Unique client IDs and topics per device.
中文
连上服务器
传感上报和远程命令最常见的通道。
官方路径: examples/protocols/mqtt/tcp
连接 MQTT 代理,订阅/发布。
1. 等 GOT_IP。
2. 配 broker、Client ID,注册事件。
3. CONNECTED 后订阅并发布。
4. DATA 里解析业务;官方只打印。
5. 量产 Client ID 和主题必须按设备唯一。