Gsm800 mqtt库

Gsm800 mqtt库,mqtt,gsm,arduino-uno,Mqtt,Gsm,Arduino Uno,我有sim800模块,我想控制来自Web服务器的中继,所以我需要mqtt库和arduino uno的示例代码。请帮助我,什么是AT命令,用于使用arduino uno发布和订阅sim800中的标记,我想您的sim800模块不太可能有AT命令用于mqtt Arduino有几个MQTT库: AdaFruit: Nick O'Leary的PubSubClient: 这两个库都应该与实现客户机接口以外的任何库一起使用。因此,应该可以创建与GSM模块对话的TCP客户端 如果SIM800支持GSM库,则

我有sim800模块,我想控制来自Web服务器的中继,所以我需要
mqtt
库和arduino uno的示例代码。请帮助我,什么是
AT
命令,用于使用arduino uno发布和订阅sim800中的标记,我想您的sim800模块不太可能有AT命令用于mqtt

Arduino有几个MQTT库:

  • AdaFruit:
  • Nick O'Leary的PubSubClient:
这两个库都应该与实现客户机接口以外的任何库一起使用。因此,应该可以创建与GSM模块对话的TCP客户端

如果SIM800支持GSM库,则实现客户端接口的:


如果您使用的是Arduino中的硬件串行端口,那么使用Leonardo可能比Uno更好,因为您可以使用USB对Arduino进行编程,使用硬件串行端口与GSM模块进行通信。

您可以尝试使用客户端库。它具有成熟的MQTT库,支持MQTT 3.1、MQTT 3.1.1和SSL/TLS。

SIM800 GSM调制解调器的MQTT库可在

功能:

自动连接

   Automatically connect to TCP and to MQTT server.
连接功能

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
OnConnect回调函数

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
发布功能

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
订阅功能

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
OnMessage回调函数

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
取消订阅功能

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
断开功能

   This function can be used to connect your client to MQTT broker.
   Use only if you do not use Auto connect functionality.
   Optionally  you can use username, password, WILL topic and WILL Message.
   This call back function is called when MQTT connection is established.
   You can call subscription and publish functions inside it (according to your need).
   This function can be used to publish messages to different topics.
   You can select  QoS levels and RETAIN flag according to your need.
   This function can be used to subscribe messages from different topics.
   This callback function is called when messages are received from  subscribed topics
   Topic, TopicLength, Message, MessageLength are the arguments of  OnMessage callback function.
   Inside this, you can write your custom code.
   This function can be used to unsubscribe from a previously subscribed topic.
   This function can be used to disconnect your client from MQTT broker.
保持活力

   You can specify your KeepAlive duration while initializing.
   Ping requests are sent and received automatically.

感谢您的建议。请至少添加一个可以发布和订阅的工作示例