开发环境:野火的stm32f407,
rt-thread studio版本是版本: 2.2.6,
stm32f4的资源包为0.2.2,
mymqtt软件包版本为latest。
在上一篇文章 RT-Thread中Lan8720和lwip协议栈的使用的工程基础上添加mymqtt软件包。
使能mqtt example和mqtt test,保存,等待下载更新软件包。
编译,本以为一切ok,但是却提示mqtt test.c文件有错误,错误提示unknown type name 'MQTTClient'。
可以根据错误提示自行修改或者在配置中取消使能mqtt test,这里我在配置中取消使能mqtt test,重新编译,但是仍然报错,报错提示fatal error: dfs_posix.h: No such file or directory,
根据提示,屏蔽掉头文件
//#include <dfs_posix.h>
重新编译,编译正常。
查看mqtt example文件中的测试文件,可知道测试指令为:
mqtt_start, startup mqtt client
mqtt_stop, stop mqtt client
mqtt_publish, mqtt publish message to specified topic
mqtt_subscribe, mqtt subscribe topic
mqtt_unsubscribe, mqtt unsubscribe topic
在终端中输入指令进行测试,测试如下,
mqtt客户端启动

mqtt订阅主题

mqtt发布主题

mqtt客户端停止

原作者:YZRD
|