2016-06-14 2 views
0

私はsim800モジュールを持っていますので、私はmqttライブラリとarduinoのサンプルコードが必要ですので、私に助けてくださいAT arduino unoを使用してsim800でタグを購読するにはどういうコマンドですGsm800 mqttライブラリ

答えて

2

私はあなたのSIM800モジュールは、MQTT用のATコマンドを持つことは非常に低いと思います。

ArduinoのためのMQTTライブラリのカップルがあります。

がよりこれらのライブラリの両方がどのライブラリで動作するはずですClientインターフェイスを実装します。したがって、GSMモジュールと通信するTCPクライアントを作成することは可能です。

SIM800は、クライアントインタフェースを実装すること、その後GSMライブラリをサポートしている場合: https://www.arduino.cc/en/Reference/GSM

あなたはArduinoのハードウェアシリアルポートを使用している場合は、宇野よりレオナルドを使用して良いかもしれない、あなたができるので、 ArduinoをプログラムするためにUSBを使用し、GSMモジュールと通信するハードウェアシリアルを使用します。

+0

提案を与えるための感謝 –

0

あなたはPaho Arduinoクライアントライブラリを使用して試すことができます。 MQTT 3.1、MQTT 3.1.1 & SSL/TLSをサポートする完全なMQTTライブラリーを備えています。SIM800 GSMモデムの

0

MQTTライブラリElementzTechBlogで入手でき、ElementzGithubRepositoryElementzOnlineCart

机能:

自動

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. 

のOnConnectコールバック機能

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. 
のonMessageコールバック関数

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. 

Keep Aliveを

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

パブリッシュおよびサブスクライブすることができる少なくとも1つの実施例を追加してください。 –