13-51 MCU ESP8266 learning-AT command (ESP8266 as a TCP client, connect to a TCP server, use serial port debugging assistant and mobile phone TCP debugging assistant to test)

After writing the title, I just remembered one thing. If the mobile phone is used as a client (without connecting to the router), the wireless of the mobile phone connection module will be assigned an IP address,,, I don't know this IP address beforehand....I First, see if there is an instruction in the AT command to print the IP address of the device connected to its own wifi signal.

did not find.......................

Forget it, I connect directly with my mobile phone, look at the IP address assigned by the mobile phone, and then set up the module
APP, which can be downloaded and installed in Baidu Mobile Assistant, Android Market, 91 Assistant (search for "Xiaowu Internet of Things")


image

 

image
We still set the working mode of the module to mode 3

AT+CWMODE_DEF=3

image
image
Send AT+CIPMUX=0 to start a single connection, first make a single connection

AT command single connection can achieve transparent transmission

AT+CIPMUX=0
image
then let the module connect to the server

AT+CIPSTART="TCP","192.168.4.2",8080

image

image

Send data from mobile

image

image
Now let the module send to the phone

When a single connection is made, the command to send is AT+CIPSEND=x, where x is the number of bytes sent
image
image

image

Now send a command to let the module transparently transmit, no more commands before sending data, and let the module automatically forward,
image
although it is set, but it doesn't seem to be possible...

But it seems that the command has been changed.

AT+SAVETRANSLINK=1,"192.168.4.2",8080,"TCP"

image

image

image

image
It seems that it should be modified, and it has been made into a save mode, and the settings will be saved when the power is turned off.

The new version of the AT command seems to be specially made to save the settings inside the module. It is set to automatically work after the next power-on, and there is no need for secondary configuration...

Another point, this command can be sent directly, without configuring single connection or multi-connection, no matter how it is configured, but the connection or multi-connection has no effect on this command,
so you can directly establish a TCP pass through
AT+SAVETRANSLINK=1, "192.168. 4.2",8080,"TCP"
exits transparent transmission and sends "+++"

image

But that command is still stored inside the module, and the module will be automatically connected and transparently transmitted when the module is powered off.

To clear this command, first send "+++"

Then AT+RESTORE restore factory settings
image

image

The new version of the instructions does a good job, it is much more convenient than the previous one, it's too late to go to bed,,,,

Write another day to write multi-connection mode

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325065687&siteId=291194637