esp8266 at 指令 -...

18
版本 1.3 版权 © 2017 ESP8266 AT 指令 使示

Upload: vankhanh

Post on 27-Feb-2018

348 views

Category:

Documents


8 download

TRANSCRIPT

  • !

    !

    1.3

    2017

    ESP8266 AT

  • ESP8266_NONOS_SDK AT

    1 AT

    2 TCP Client ESP8266 TCP Client

    3 UDP UDP

    4

    5 TCP Server ESP8266 TCP Server

    6 AT

    2017.08 V1.3

    http://www.espressif.com/zh-hans/subscribehttp://espressif.com/zh-hans/certificates

  • 1. 1 .........................................................................................................................................

    2. TCP Client 2 ..................................................................................................................

    3. UDP 4 ................................................................................................................................

    3.1. UDP 4.................................................................................................................

    3.2. UDP 6.................................................................................................................

    4. 8 .........................................................................................................................................

    4.1. TCP Client 8...............................................................................................................

    4.2. UDP 10..................................................................................................................................

    5. TCP Server 12 ...............................................................................................................

    6. 14...............................................................................................................................

  • !1.

    1. ESP8266_NONOS_SDK AT AT ESP8266_AT_Instruction_Set

    ESP8266 AT Binhttp://www.espressif.com/en/support/download/at

    - README.md

    PC ESP8266 AT

    - 115200

    - AT CR LF

    AT

    Espressif ! /!1 15 2017.08

    http://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_cn.pdfhttp://www.espressif.com/en/support/download/at

  • !2. TCP Client

    2. TCP Client 1. WiFi

    AT+CWMODE=3//softAP+stationmode

    :

    OK

    2.

    AT+CWJAP="SSID","password"//SSIDandpasswordofrouter

    :

    OK

    3. ESP8266 IP

    AT+CIFSR

    :

    +CIFSR:APIP,"192.168.4.1"

    +CIFSR:APMAC,"1a:fe:34:a5:8d:c6"

    +CIFSR:STAIP,"192.168.3.133"

    +CIFSR:STAMAC,"18:fe:34:a5:8d:c6"

    OK

    4. PC ESP8266 PC TCP

    - PC IP 192.168.3.116 8080

    5. ESP8266 TCP client

    AT+CIPSTART="TCP","192.168.3.116",8080 //protocol,serverIPandport

    :

    OK

    6. ESP8266

    AT+CIPSEND=4//setdatelengthwhichwillbesent,suchas4bytes

    >test //enterthedata,noCR

    :

    Recv4bytes

    Espressif ! /!2 15 2017.08

  • !2. TCP Client

    SENDOK

    7. ESP8266

    +IPD,n:xxxxxxxxxx//receivednbytes,data=xxxxxxxxxxx

    n

    - busy n SEND OK

    -

    Espressif ! /!3 15 2017.08

  • !3. UDP

    3. UDP UDP server client AT+CIPSTART

    1. WiFi

    AT+CWMODE=3//softAP+stationmode

    :

    OK

    2.

    AT+CWJAP="SSID","password"//SSIDandpasswordofrouter

    :

    OK

    3. ESP8266 IP

    AT+CIFSR

    :

    +CIFSR:APIP,"192.168.4.1"

    +CIFSR:APMAC,"1a:fe:34:a5:8d:c6"

    +CIFSR:STAIP,"192.168.101.133"

    +CIFSR:STAMAC,"18:fe:34:a5:8d:c6"

    OK

    4. PC ESP8266 PC UDP

    - PC UDP IP 192.168.101.116 8080

    5. UDP

    3.1. UDP

    UDP AT+CIPSTART 0 UDP

    1.

    AT+CIPMUX=1

    :

    Espressif ! /!4 15 2017.08

  • !3. UDP

    OK

    2. UDP 4

    AT+CIPSTART=4,"UDP","192.168.101.110",8080,1112,0

    :

    4,CONNNECT

    OK

    3.

    AT+CIPSEND=4,7 //Send7bytestotransmissionNO.4

    >UDPtest //enterthedata,noCR

    :

    Recv7bytes

    SENDOK

    4. ESP8266

    +IPD,4,n:xxxxxxxxxx//receivednbytes,data=xxxxxxxxxxx

    5. UDP

    AT+CIPCLOSE=4

    :

    4,CLOSED

    OK

    "192.168.101.110", 8080 UDP IP 4 PC UDP

    1112 ESP8266 UDP

    0 UDP UDP UDP ESP8266 UDP 1112ESP8266 4 UDP AT+CIPSEND=4, X PC

    n

    - busy n SEND OK

    -

    Espressif ! /!5 15 2017.08

  • !3. UDP

    3.2. UDP

    AT+CIPSTART UDP 2 UDP

    1. UDP

    AT+CIPSTART="UDP","192.168.101.110",8080,1112,2

    :

    CONNNECT

    OK

    2.

    AT+CIPSEND=7 //Send7bytes

    >UDPtest //enterthedata,noCR

    :

    Recv7bytes

    SENDOK

    3. 192.168.101.111, 1000

    AT+CIPSEND=7,"192.168.101.111",1000 //Send7bytes

    >UDPtest //enterthedata,noCR

    :

    Recv7bytes

    SENDOK

    "192.168.101.110", 8080 UDP IP PC UDP

    1112 ESP8266 UDP

    2 UDP UDP UDP ESP8266 UDP

    n

    - busy n SEND OK

    -

    Espressif ! /!6 15 2017.08

  • !3. UDP

    4. ESP8266

    +IPD,n:xxxxxxxxxx//receivednbytes,data=xxxxxxxxxxx

    5. UDP

    AT+CIPCLOSE

    :

    CLOSED

    OK

    Espressif ! /!7 15 2017.08

  • !4.

    4. ESP8266 AT TCP client UDP

    4.1. TCP Client

    ESP8266 station TCP client ESP8266 softAP

    1. WiFi

    AT+CWMODE=3//softAP+stationmode

    :

    OK

    2.

    AT+CWJAP="SSID","password"//SSIDandpasswordofrouter

    :

    OK

    3. ESP8266 IP

    AT+CIFSR

    :

    +CIFSR:APIP,"192.168.4.1"

    +CIFSR:APMAC,"1a:fe:34:a5:8d:c6"

    +CIFSR:STAIP,"192.168.3.133"

    +CIFSR:STAMAC,"18:fe:34:a5:8d:c6"

    OK

    4. PC ESP8266 PC TCP

    - PC IP 192.168.3.116 8080

    5. ESP8266 TCP client

    AT+CIPSTART="TCP","192.168.3.116",8080 //protocol,serverIPandport

    :

    OK

    Espressif ! /!8 15 2017.08

  • !4.

    6.

    AT+CIPMODE=1

    :

    OK

    7. ESP8266

    AT+CIPSEND

    > //Fromnowon,datareceivedfromUARTwillbetransmittedtoserverautomatically.

    8.

    +++

    - +++ + +++

    - 1 AT

    9.

    AT+CIPMODE=0

    :

    OK

    10. TCP

    AT+CIPCLOSE

    :

    CLOSED

    OK

    n

    - busy n SEND OK

    -

    +++ AT TCP AT+CIPSEND

    Espressif ! /!9 15 2017.08

  • !4.

    4.2. UDP

    ESP8266 softAP UDP ESP8266 station

    1. WiFi

    AT+CWMODE=3//softAP+stationmode

    :

    OK

    2. PC ESP8266 softAP

    3. PC UDP

    - PC UDP IP 192.168.4.2 1001

    4. ESP8266 PC UDP

    AT+CIPSTART="UDP","192.168.4.2",1001,2233,0

    :

    OK

    5.

    AT+CIPMODE=1

    :

    OK

    6. ESP8266

    AT+CIPSEND

    > //Fromnowon,datareceivedfromUARTwillbetransmittedtoserverautomatically.

    Espressif ! /!10 15 2017.08

  • !4.

    7.

    +++

    - +++ + +++

    - 1 AT

    8.

    AT+CIPMODE=0

    :

    OK

    9. TCP

    AT+CIPCLOSE

    :

    CLOSED

    OK

    n

    - busy n SEND OK

    -

    +++ AT TCP AT+CIPSEND

    Espressif ! /!11 15 2017.08

  • !5. TCP Server

    5. TCP Server ESP8266 AT TCP TCP client

    ESP8266 softAP TCP ESP8266 station

    1. WiFi

    AT+CWMODE=3//softAP+stationmode

    :

    OK

    2.

    AT+CIPMUX=1

    :

    OK

    3. TCP server

    AT+CIPSERVER=1 //defaultport=333

    :

    OK

    4. PC ESP8266 softAP

    5. PC TCP client ESP8266 TCP server

    Espressif ! /!12 15 2017.08

  • !5. TCP Server

    6.

    //IDnumberofconnectionisdefaultedtobe0.

    AT+CIPSEND=0,4//send4bytestoconnectionNO.0

    >test //enterthedata,noCR

    :

    Recv4bytes

    SENDOK

    7. ESP8266

    +IPD,0,n:xxxxxxxxxx//receivednbytes,data=xxxxxxxxxxx

    8. UDP

    AT+CIPCLOSE=0

    :

    0,CLOSED

    OK

    ESP8266 TCP server ESP8266 TCP server TCP client PC TCP client ESP8266 TCP server 2s

    n

    - busy n SEND OK

    -

    Espressif ! /!13 15 2017.08

  • !6.

    6. AT

    AT AT+GMR

    ESP-WROOM-02

    AT+CWMODE_CUR=1

    OK

    AT+GMR

    ATversion:0.23.0.0(Apr24201521:11:01)

    SDKversion:1.0.1

    compiletime:Apr24201521:19:31

    OK

    AT+CIPSTAMAC_DEF="14:CF:11:22:33:05"

    OK

    log log

    etsJan82013,rstcause:1,bootmode:(3,3)

    load0x40100000,len26336,room16

    tail0

    chksum0xde

    load0x3ffe8000,len5672,room8

    tail0

    chksum0x69

    load0x3ffe9630,len8348,room8

    tail4

    chksum0xcb

    csum0xcb

    SDKversion:0.9.1

    addrnotackwhentxwritecmd

    mode:sta(18:fe:34:97:d5:7b)+softAP(1a:fe:34:97:d5:7b)

    Espressif ! /!14 15 2017.08

    http://espressif.com/zh-hans/company/contact/after-sale-questions

  • !

    Espressif ! /!15 15 2017.08

    URL

    Wi-Fi Wi-Fi Bluetooth SIG

    2017

    IoT

    www.espressif.com

    http://www.espressif.com