8-STM32 things development WIFI + GPRS Basics (STM32 + GPRS (AT command) to achieve communication MQTT remote control)

https://www.cnblogs.com/yangfengwu/p/11482905.html

On a test of this section is the Wi-Fi test GPRS

 

 

 

See the name to know, simply means that the microcontroller using AT commands control module for communication control MQTT

This section is STM32 + GPRS (AT command) to achieve communication control MQTT:

First, download the program STM32

1, a way, serial download (download other way in the final supplement)

Adjusting the position of the toggle switch ① → → 3.3V and short BOOT0 reset STM32

 

 

 

② Open download software, download program

 

Selecting the right serial port

 

 

 

 

 

Remove shorted, reset the microcontroller

 

 

 

 

 

 

① phone card

② antenna

③ to adjust the toggle switch, and so the GPRS communication STM32

 

 

 

 

Open the phone APP

Download APP (APP purchase to secure the articles to get, only learned a small micro-channel Programming can be able to understand the source code, knowledge involves a little more)

 

Scan code download

 

  

 

 

 

 

 

 

 

Note: Only when normal communication MQTT description (just found out that you can insert video ....)

 

 

then

 

 

 

 

 

Finally, talk about the program

First look at the official documentation

 

 

 

 

Check yourself

 

On an overall code and the same, there are several places to talk about

 

 

In order to shorten the time it is actually transmitted command, as long as the received corresponding data is determined, and transmits the next instruction immediately

 

 

However, to be safe, middle 500ms delay

 

Further, with the main function inside a serial callback   

If you want to know how to write the callback function, you can look at this   https://www.cnblogs.com/yangfengwu/p/11112014.html

 

 

Get IMEI, I feel so get IMEI safer.

 

 

Note: This code does not cook, reconnection of it!

 

In fact, with GPRS MQTT achieve a place of contradictions.

MQTT heartbeat packet is determined by the device is not online, the heartbeat packet data C0,00

But then, speaking for GPRS, heartbeat packet time is too short ... we need more traffic

Too long, then you can not know in time not dropped off ....

 

Guess you like

Origin www.cnblogs.com/yangfengwu/p/11484159.html