
!
4. Wi-Fi AT Commands
4.2.5. AT+CWJAP_CUR—Connects to an AP; Configuration Not Saved in the Flash
4.2.6. AT+CWJAP_DEF—Connects to an AP; Configuration Saved in the Flash
Commands
Query Command:
AT+CWJAP_CUR?
Function: to query the AP to which the ESP8266
Station is already connected.
Set Command:
AT+CWJAP_CUR=<ssid>,<pwd>[,<bssid>]
Function: to set the AP to which the ESP8266
Station needs to be connected.
Response
+CWJAP_CUR:<ssid>,<bssid>,<channel>,<rssi>
OK
OK
or
+CWJAP_CUR:<error code>
ERROR
Parameters
<ssid>
: a string parameter showing the SSID of
the target AP.
•
<ssid>
: the SSID of the target AP.
•
<pwd>
: password, MAX: 64-byte ASCII.
•
[<bssid>]
: the target AP’s MAC address, used
when multiple APs have the same SSID.
•
<error code>
: (for reference only)
‣
1
: connection timeout.
‣
2
: wrong password.
‣
3
: cannot find the target AP.
‣
4
: connection failed.
This command requires Station mode to be active.
Escape character syntax is needed if SSID or
password contains any special characters, such as ,
or ” or \.
Note
The configuration changes will NOT be saved in the flash.
Examples
AT+CWJAP_CUR="abc","0123456789"
For example, if the target AP’s SSID is
"ab\,c"
and the password is
"0123456789"\"
, the command is
as follows:
AT+CWJAP_CUR="ab\\\,c","0123456789\"\\"
If multiple APs have the same SSID as
"abc"
, the target AP can be found by BSSID:
AT+CWJAP_CUR="abc","0123456789","ca:d7:19:d8:a6:44"
Commands
Query Command:
AT+CWJAP_DEF?
Function: to query the AP to which the ESP8266
Station is already connected.
Set Command:
AT+CWJAP_DEF=<ssid>,<pwd>[,<bssid>]
Function: to set the AP to which the ESP8266
Station needs to be connected.
Response
+CWJAP_DEF:<ssid>,<bssid>,<channel>,<rssi>
OK
OK
or
+CWJAP__DEF:<error code>
ERROR
Espressif
!
/
!
23 58
2017.05