
Ò»¡¢²âÊÔ×¼±¸
1¡¢×ÊÁÏÏÂÔØ£º
GM35V2ÅäÖÃÈí¼þÏÂÔصØÖ·:http://www.usr.cn/Download/746.html
GM35V2-Q Ö¸Á£ºhttp://www.usr.cn/Down/WH-GM35V2-MQTT-AT_V1.0.0.pdf
2¡¢ÍøÂçÍØÆËͼÈçÏ£º
¶þ¡¢²ÎÊýÉèÖÃ
·½·¨Ò»£ºATÖ¸ÁîÅäÖòÙ×÷¹ý³Ì£º
1¡¢´ò¿ªÅäÖÃÈí¼þ£¬´ò¿ª´®¿Ú£¬µã»÷½øÈëÅäÖÃ״̬¡£Ä£¿é·µ»ØokÖ®ºó´ú±í½øÈëÅäÖÃ״̬³É¹¦¡£
ÒÀ´ÎÊäÈëÒÔÏÂÖ¸Á//Ö®ºóΪ¶ÔÖ¸ÁîµÄ½âÊͶø²»ÊÇÖ¸ÁîµÄÒ»²¿·Ö£©£º
AT+WMODE=0 //ÉèÖÃÄ£¿é¹¤×÷ģʽΪmqttÖ¸Áîģʽ
AT+WMODE=0
OK
AT+CLIENTID="c42b31bbb4cf45c08259e8a1564e443a" //ÉèÖÃÄ£¿éµÄmqtt client id£¬Õâ¸öid¸ù¾ÝÁ¬½ÓµÄ·þÎñÆ÷ÀàÐͽøÐоßÌåÉèÖã¬ÕâÀïÉèÖõÄidÊÇÈÎÒâµÄ
AT+CLIENTID="c42b31bbb4cf45c08259e8a1564e443a"
OK
AT+IPPORT="39.105.117.9",1883 //ÉèÖ÷þÎñÆ÷ipºÍ¶Ë¿Ú£¬Õâ¸öipºÍ¶Ë¿ÚΪÁÙʱ²âÊÔ·þÎñÆ÷£¬Óû§ÔÚʵ¼ÊÁ¬½Óʱ£¬ÐèÒªÁ¬½Ó×Ô¼ºµÄ·þÎñÆ÷½øÐÐͨÐŲâÊÔ
AT+IPPORT="39.105.117.9",1883
OK
AT+USERPWD="usr","www.usr.cn" //ÉèÖÃÁ¬½ÓµÄÓû§ÃûºÍÃÜÂë
AT+USERPWD="usr","www.usr.cn"
OK
AT+s //±£´æÅäÖÃ
AT+s
OK
RDY
+CFUN: 1
+CPIN: READY
^STN: 37
+STATUS: MQTT READY //·µ»Ømqtt ready´ú±íÒѾ´¦ÓÚ×¼±¸×´Ì¬
AT+start //±íÃ÷ºóÃæ¿ÉÒÔ¿ªÊ¼mqtt´«Êä
AT+start
OK
+STATUS: MQTT CONNECT OK //·µ»Ø¸ÃÊý¾Ý´ú±ímqttÁ¬½Ó³É¹¦
´ò¿ªmqtt¿Í»§¶Ë£¬ÕâÀïʹÓõÄʱmqttfxÈí¼þ£¬ÉèÖøÃÈí¼þÓëgm35Á¬½ÓÈëͬһ¸ömqtt·þÎñÆ÷¡£
ÔÚÈí¼þÉ϶©ÔÄÖ÷ÌâÃû×ÖΪtopic/002
È»ºóÎÒÃÇÔÚÄ£¿éÅäÖÃÈí¼þÉÏÃæʹÓÃATÖ¸ÁîAT+SUBSCRIBE=topic/002,1·¢ËÍÊý¾Ý£¬topic/002±íʾ·¢ËÍÖ÷Ì⣬1±íʾ½«Òª·¢Ë͵Ä×Ö½ÚÊý¡£·¢ËÍÖ®ºóÄ£¿é»á·µ»ØÒ»¸ö×Ö·û>£¬·¢ËÍ5£¬Ö®ºóÄ£¿é»á·µ»Øok£¬±íʾ·¢Ëͳɹ¦¡£
´ËʱÈí¼þÒѽ«½ÓÊÕµ½ÁËÕâ¸öÊý¾Ý
ͨ¹ýÈí¼þȥϷ¢Ö÷Ìâtopic/003£¬Ö÷ÌâÄÚÊý¾ÝΪ111
ÔÚÅäÖÃÈí¼þ·¢ËÍATÖ¸ÁîAT+SUBSCRIBE=topic/003,1¶©ÔĸÃÖ÷Ì⣬½ÓÊÕµ½¸ÃÊý¾Ý
·½·¨¶þ£ºÉèÖÃÈí¼þ½çÃæÉèÖÃ
1.ÅäÖô®¿Ú²ÎÊýºó£¬µã»÷¹Ø±Õ´®¿Ú£¬¼´¿ÉÅäÖÃÄ£¿é²ÎÊý¡£½¨ÒéÏȲéѯģ¿éµÄ°æ±¾ÐÅÏ¢£¬¶ÔӦѡÔñ°æ±¾
2.ÅäÖúòÎÊýºó£¬µã»÷ÉèÖò¢±£´æËùÓвÎÊý£¬Ä£¿é»áÖ´Ðб£´æÖØÆôµÈµ½Ä£¿é·µ»Ø+STATUS: MQTT READYºó£¬¼´¿Ìµã»÷Start£¬Á¬½Ó·þÎñÆ÷.
3.ÅäÖÃÒªÍÆË͵ÄÖ÷Ìâµã»÷ÍÆËÍ£¬ÔÚ´®¿Ú³öÏÖ¡°>¡±Ö®ºóÔÚ·¢ËÍ´®¿Ú·¢ËÍÊý¾Ý£¬µ±Ä£¿é½ÓÊܵ½ÉèÖõij¤¶ÈµÄÊý¾Ýʱ»á×Ô¶¯ÍÆËÍ£¬·þÎñÆ÷ÊÕµ½ºóÄ£¿é»á·µ»ØÒ»¸öPublish OK
6. Á¬½Ó¸ñʽ