!
9.
Herein we introduce some examples of how to use Espressif's AT Commands.
9.1. ESP32 as a TCP Client in Single Connection
1. Set the Wi-Fi mode:
AT+CWMODE=3 // SoftAP+Station mode
Response:
OK
2. Connect to the router:
AT+CWJAP="SSID","password" // SSID and password of router
Response:
OK
3. Query the device's IP:
AT+CIFSR
Response:
192.168.3.106 // device got an IP from router
4. Connect the PC to the same router which ESP32 is connected to. Use a network tool
on the PC to create a TCP server.
- For example, the TCP server on PC is 192.168.3.116, port 8080.
5. ESP32 is connected to the TCP server as a client:
AT+CIPSTART="TCP","192.168.3.116",8080 // protocol、server IP & port
6. Send data:
AT+CIPSEND=4 // set date length which will be sent, such as
4 bytes
>TEST // enter the data, no CR
Response:
SEND OK
⚠ Notice:
If the number of bytes inputted are more than the size defined (n):
•
-
-
Espressif
AT Commands Examples
the system will reply busy, and send the first n bytes.
and after sending the first n bytes, the system will reply SEND OK.
67 97
!
/!
9. AT Commands Examples
2019.06
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers