[SOLVED] android AN1509 ATK-ESP8266 WIFI

$25

File Name: android_AN1509_ATK-ESP8266_WIFI_.zip
File Size: 301.44 KB

5/5 - (1 vote)

AN1509 ATK-ESP8266 WIFI
(AN1509CMini STM32F10313) Mini STM32F103 ATK-ESP8266 WIFI
: 1ATK-ESP8266 WIFI 2
3
4
1ATK-ESP8266 WIFI
ATK-ESP8266 ALIENTEK UART-WiFi(-) ATK-ESP8266ATK-ESP-01FCCCE
ATK-ESP8266 (LVTTL) MCU() TCP/IP WIFI
ATK-ESP8266 (WIFI)
ATK-ESP8266 LVTTL 3.3V 5V WIFI STA AP WIFI STA+WIFI AP -WIFI
ATK-ESP8266 (29mm*19mm) 6 2.54mm 1.1 :
1.1 ATK-ESP8266 1.1 1.1 :

1
VCC
(3.3V~5V)
2
GND

3
TXD
(TTL RS232 !) RXD
4
TXD
(TTL RS232 !) TXD
5
RST
()
6
IO_0
()
1.1 ATK-ESP8266 ATK-ESP8266 WIFI 1.2 :
1.2 ATK-ESP8266 WIFI
1.1
ALIENTEK Mini STM32F103 ATK-ESP8266 WIFI : AP(COM-AP) STA(COM-STA) AP+STA(COM-AP+STA) 3 TCP TCP UDP 3

1.1.1 AT
AT AT : AT+= r

r
16 0X0D0X0A

:AT+CWMODE?r
WIFI :AT+CWMODE=3r
WIFI AP+STA ATK-ESP8266 1.1.1.1 :
RST

GMR

CWMODE
WIFI
CWJAP
AP
CWLAP
AP
CWQAP
AP
CWSAP
AP WIFI
CWLIF
IP
CIPSTATUS

CIPSTART
TCP UDP
CIPSEND

CIPCLOSE
TCPUDP
CIFSR
IP
CIPMUX

CIPSERVER

CIPMODE

CIPSTO

CIUPDATE

1.1.1.1ATK-ESP8266 AT 1.1.2 WIFI(COM-AP)
WIFI(COM-AP) WIFI WIFI (WIFI) 3 :TCP TCP UDP
AT :1();2 WIFI PAD
WIFI AP TCP 1.1.2.1 :

AT+CWMODE=2
WIFI AP
AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=1

AT+CIPSERVER=1,8086
SERVER 8086
AT+CIPSEND=0,25
ID0 25
1.1.2.1 WIFI AP TCP WIFI AP TCP 1.1.2.2 :

AT+CWMODE=2
WIFI AP

AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=0

AT+CIPSTART=TCP,192.168 .4.XXX,8086
TCP 192.168.4.XXX,8086
AT+CIPMODE=1
( client )
AT+CIPSEND

1.1.2.2 WIFI AP TCP WIFI AP UDP 1.1.2.3 :

AT+CWMODE=2
WIFI AP
AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=0

AT+CIPSTART=UDP,192.168 .4.XXX,8086
UDP 192.168.4.XXX,8086
AT+CIPSEND=25
UDP 25
1.1.2.3 WIFI AP UDP 1.1.3 STA(COM-STA)
STA(COM-STA) WIFI STA (WIFI) 3 :TCP TCP UDP
AT :1();2 DHCP
STA TCP 1.1.3.1 :

AT+CWMODE=1
WIFI STA
AT+RST

AT+CWJAP=ALIENTEK, 15902020353
WIFI :ALIENTEK:15902020353
AT+CIPMUX=1

AT+CIPSERVER=1,8086
8086
AT+CIPSEND=0,25
ID0 25
1.1.3.1 STA TCP STA TCP 1.1.3.2 :

AT+CWMODE=1
WIFI STA
AT+RST

AT+CWJAP=ALIENTEK,
WIFI :ALIENTEK:15902020353

15902020353
AT+CIPMUX=0

AT+CIPSTART=TCP,19 2.168.1.XXX,8086
TCP 192.168.1.XXX,8086
AT+CIPMODE=1

AT+CIPSEND

1.1.3.2 STA TCP STA UDP 1.1.3.3 :

AT+CWMODE=1
WIFI STA
AT+RST

AT+CWJAP=ALIENTEK, 15902020353
WIFI :ALIENTEK:15902020353
AT+CIPMUX=0

AT+CIPSTART=UDP,19 2.168.1.XXX,8086
UDP 192.168.4.XXX,8086
AT+CIPSEND=25
UDP 25
1.1.3.3 STA UDP 1.1.4 AP+STA(COM-AP+STA)
AP+STA(COM-AP+STA)WIFI APSTA WIFI (WIFI) 9 :(TCP TCP UDP)||(TCP TCP UDP)
AT :1();2 WIFI PAD;3 DHCP
3 AP STA
AP+STA AP TCP STA TCP 1.1.4.1 :

AT+CWMODE=3
WIFI AP+STA
AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
WIFI :ALIENTEK:15902020353
AT+CWJAP=ALIENTEK,159 02020353
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=1

AT+CIPSERVER=1,8086
8086
AT+CIPSTO=1200
1200s
AT+CIPSEND=0,25
ID0
AT+CIPSEND=1,25
ID1
1.1.4.1 AP+STA AP TCP STA TCP AP+STA AP TCP STA TCP 1.1.4.2

:

AT+CWMODE=3
WIFI AP+STA
AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
WIFI :ALIENTEK:15902020353
AT+CWJAP=ALIENTEK,159 02020353
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=1

AT+CIPSERVER=1,8086
8086
AT+CIPSTO=1200
1200s
AT+CIPSTART=0,TCP,192.1 68.1.XXX,8086
STA ID0 192.168.1.XXX8086
AT+CIPSEND=0,25
ID0
AT+CIPSEND=1,25
ID1
1.1.4.2 AP+STA AP TCP STA TCP AP+STA AP TCP STA UDP 1.1.4.3

AT+CWMODE=3
WIFI AP+STA
AT+RST

AT+CWSAP=ATK-ESP8266, 12345678,1,4
WIFI :ALIENTEK:15902020353
AT+CWJAP=ALIENTEK,159 02020353
AP :SSID ATK-ESP8266 12345678 1:WPA_WPA2_PSK
AT+CIPMUX=1

AT+CIPSERVER=1,8086
8086
AT+CIPSTO=1200
1200s
AT+CIPSTART=0,UDP,192.1 68.1.XXX,8086
STA ID0 192.168.1.XXX8086
AT+CIPSEND=0,25
ID0
AT+CIPSEND=1,25
ID1
1.1.4.3 AP+STA AP TCP STA UDP 2
2.1
: ATK-ESP8266 3
3 2.1.1 WIFI(COM-AP)
:WIFI <——–>1ATK-ESP8266
1 :(WIFI)
KEY_UP WIFI AP

3 :TCP TCP UDP KEY0/KEY1 KEY_UP (TCP ) IP TCP /UDP IP : IP IP
:
IP : IP ATK-ESP8266 IP IP
: 8086 : :(TCP TCP UDP) : KEY0

: ATK-ESP8266

KEY_UP
3 :TCP TCP UDP
4
2.1.2 STA(COM-STA)
:WIFI <——><——>ATK-ESP8266 (WIFI STA)
KEY1 WIFI-STA 2.1.1
2.1.3 AP+STA(COM-AP+STA)
:WIFI <——> ATK-ESP8266 (WIFI AP+STA)<——> <——>WIFI
KEY0 ( ATK-ESP8266), WIFI AP 2.1.1 AP STA AP
AP STA : 8086 : :(:STA+AP )
AP IP:AP IP
STA IP:STA IP
: KEY0

: ATK-ESP8266

KEY_UP KEY0 ID0 KEY1

ID1
9 :(TCP TCP UDP)||(TCP TCP
UDP) 4
2.2
: 1 Mini STM32F103 1 2 ATK-ESP8266
3
4 WIFI ( WIFI ) 2.3
ATK-ESP8266 ()Mini STM32F103 ATK-ESP8266 2 AT-ESP8266 2.3.1
2.3.1 ATK-ESP8266 WIFI Mini STM32 ATK-ESP8266 WIFI2
2.3.1 :
2.3.1ATK-ESP8266 WIFI Mini RST IO_0 IO
ATK-ESP8266 WIFI
ATK-ESP8266 WIFI
VCC
GND
TXD
RXD
Mini STM32
5V/3.3V
GND
PA3
PA2

3
Mini STM32 4(ATK-SIM900A GSM ) SIM900A ATK_ESP8266 : common.cwifistawifiapapsta common.h
SIM900A ATK_ESP8266 4 .c ATK_ESP8266 ATK_ESP8266
.c 3.1 :
3.1 ATK-ESP8266 ATK-ESP8266 (conmon.c apsta.cwifista.cwifiap.c ) main common.c ATK-ESP8266 (AT )(IP
)
atk_8266_send_cmd ATK_ESP8266 AT
:

// ATK-ESP8266
//cmd: //ack:,, //waittime:(:10ms) //:0,()
// 1,
u8 atk_8266_send_cmd(u8 *cmd,u8 *ack,u16 waittime) {
u8 res=0;
USART2_RX_STA=0; u2_printf(%sr
,cmd); //
if(ack&&waittime) // {
while(waittime) // {
delay_ms(10); if(USART2_RX_STA&0X8000) {
if(atk_8266_check_cmd(ack)) {
printf(ack:%sr
,(u8*)ack); break;
}
USART2_RX_STA=0;
} }
if(waittime==0)res=1; }
return res;
//
//
}
3 cmd ack waittime (:10ms):
atk_8288_send_cmd(AT+RST,OK,20);
:AT+RST WIFI ;:OK; 200ms
atk_8266_quit_trans AT :
//ATK-ESP8266 //:0,;
// 1,
u8 atk_8266_quit_trans(void)
{
USART2->DR=+;
//
while((USART2->SR&0X40)==0);

delay_ms(15);
while((USART2->SR&0X40)==0);
USART2->DR=+;
delay_ms(15);
while((USART2->SR&0X40)==0);
USART2->DR=+;
delay_ms(500);
return atk_8266_send_cmd(AT,OK,20);//.
}
//(10ms) //
//(10ms) //
// 500ms
+++ AT AT AT+CIPMODE=0 AT
:atk_8266_consta_checkatk_8266_get_wanip atk_8266_get_ip:
// ATK-ESP8266 //:0,;1,.
u8 atk_8266_consta_check(void)
{
u8 *p;
u8 res;
if(atk_8266_quit_trans())return 0; atk_8266_send_cmd(AT+CIPSTATUS,:,50); // AT+CIPSTATUS , p=atk_8266_check_cmd(+CIPSTATUS:); res=*p;
return res;
}
// STA AP ip //ipbuf:ip
void atk_8266_get_wanip(u8* ipbuf)
{
//
//
u8 *p,*p1; if(atk_8266_send_cmd(AT+CIFSR,OK,50)) {
ipbuf[0]=0;
return; }
p=atk_8266_check_cmd(); p1=(u8*)strstr((const char*)(p+1),); *p1=0;
sprintf((char*)ipbuf,%s,p+1);
}
// AP+STA ip
// WAN IP

//ipbuf:ip void atk_8266_get_ip(u8 x,u8 y) {
u8 *p;
u8 *p1;
u8 *p2;
u8 *ipbuf;
u8 *buf; p=mymalloc(32); p1=mymalloc(32); p2=mymalloc(32);
// 32 // 32 // 32
ipbuf=mymalloc(32);
buf=mymalloc(32); if(atk_8266_send_cmd(AT+CIFSR,OK,50)) {
*ipbuf=0; }
else {
// 32 // 32 // WAN IP
p=atk_8266_check_cmd(APIP,); p1=(u8*)strstr((const char*)(p+6),); p2=p1;
*p1=0;
ipbuf=p+6;
sprintf((char*)buf,AP IP:%s :%s,ipbuf,(u8*)portnum); Show_Str(x,y,200,12,buf,12,0);
// AP IP
p=(u8*)strstr((const char*)(p2+1),STAIP,); p1=(u8*)strstr((const char*)(p+7),);
*p1=0;
ipbuf=p+7;
sprintf((char*)buf,STA IP:%s :%s,ipbuf,(u8*)portnum);
} }
Show_Str(x,y+15,200,12,buf,12,0); // STA IP
myfree(p); myfree(p1); myfree(p2); myfree(ipbuf); myfree(buf);
// // // // //
atk_8266_consta_check (TCP/UDP)(); atk_8266_get_wanip STA AP IP MAC ; atk_8266_get_ip AP+STA IP MAC

atk_8266_test:
//ATK-ESP8266 void atk_8266_test(void)
{
u8 key;
u8 timex;
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP8266 WIFI ,16,240); while(atk_8266_send_cmd(AT,OK,20)) // WIFI {
atk_8266_quit_trans();//
atk_8266_send_cmd(AT+CIPMODE=0,OK,200); Show_Str(40,55,200,16,!!!,16,0); delay_ms(800); LCD_Fill(40,55,200,55+16,WHITE); Show_Str(40,55,200,16,,16,0);
}
atk_8266_mtest_ui(32,30); while(1)
{
delay_ms(10);
//
//
while(atk_8266_send_cmd(ATE0,OK,20));
atk_8266_at_response(1);
// ATK-ESP8266 , key=KEY_Scan(0);
if(key)
{
LCD_Clear(WHITE); POINT_COLOR=RED; switch(key)
{
case 1://KEY0
Show_Str_Mid(0,30,ATK-ESP WIFI-AP+STA ,16,240); Show_Str_Mid(0,50, ATK-ESP8266 ,12,240);
atk_8266_apsta_test(); //AP+STA
break; case 2://KEY1
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str_Mid(0,50, ATK-ESP8266 ,12,240);
atk_8266_wifista_test(); //WIFI STA break;
case 4://WK_UP

atk_8266_wifiap_test();
break; }
atk_8266_mtest_ui(32,30);
timex=0; }
if((timex%20)==0)LED0=!LED0;
timex++; }
}
//WIFI AP
//200ms
ATK-ESP8266 AP :atk_8266_apsta_testatk_8266_wifista_test atk_8266_wifiap_test
common.c apsta.c :
//ATK-ESP8266 AP+STA // TCP/UDP //:0,
//,
u8 atk_8266_apsta_test(void) {
u8 netpro; u8 key=0;
u8 timex=0; u8 ipbuf[16]; u8 *p;
u16 t=999;
u8 res=0;
u16 rlen=0;
u8 constate=0; p=mymalloc(32);
//IP //
//
// 32
atk_8266_send_cmd(AT+CWMODE=3,OK,50); // WIFI AP+STA // AP WIFI // sprintf((char*)p,AT+CWSAP=%s,%s,1,4,wifiap_ssid,wifiap_password); //:ssid,
atk_8266_send_cmd(p,OK,1000); // AP
// WIFI //, !!
sprintf((char*)p,AT+CWJAP=%s,%s,wifista_ssid,wifista_password); //:ssid,
atk_8266_send_cmd(p,WIFI GOT IP,1000); // IP while(atk_8266_send_cmd(AT+CIFSR,STAIP,20)); // STA IP while(atk_8266_send_cmd(AT+CIFSR,APIP,20)); // AP IP

LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str(30,30,200,16,ATK-ESP AP+STA ,16,0); atk_8266_send_cmd(AT+CIPMUX=1,OK,50); //0:1: delay_ms(500);
sprintf((char*)p,AT+CIPSERVER=1,%s,(u8*)portnum); atk_8266_send_cmd(p,OK,50); // Server 8086 delay_ms(500);
atk_8266_send_cmd(AT+CIPSTO=1200,OK,50); //
PRESTA:
netpro=atk_8266_netpro_sel(50,30,(u8*)ATK_ESP8266_CWMODE_TBL[0]); //AP+STA
if(netpro&0X02) //STA UDP
{
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); if(atk_8266_ip_set(WIFI-STA UDP IP ,UDP
,(u8*)portnum,ipbuf))goto PRESTA; //IP sprintf((char*)p,AT+CIPSTART=0,UDP,%s,%s,ipbuf,(u8*)portnum); // UDP , ID STA 0
LCD_Clear(WHITE);
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); atk_8266_send_cmd(p,OK,200);
netpro=atk_8266_mode_cofig(netpro);
}
else //TCP {
if(netpro&0X01) //STA TCP Client
//AP
{
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); if(atk_8266_ip_set(WIFI-STA IP
,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro],(u8*)portnum,ipbuf))goto PRESTA; //IP
sprintf((char*)p,AT+CIPSTART=0,TCP,%s,%s,ipbuf,(u8*)portnum); // TCP , ID STA 0 while(atk_8266_send_cmd(p,OK,200))
{

LCD_Clear(WHITE);
POINT_COLOR=RED; Show_Str_Mid(0,40,WK_UP:,16,240); Show_Str(30,80,200,12,ATK-ESP UDP ,12,0); //
key=KEY_Scan(0);
if(key==4)goto PRESTA; }
netpro=atk_8266_mode_cofig(netpro); else netpro=atk_8266_mode_cofig(netpro);
//AP //TCP SERVER
}
}
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA+AP ,16,240); Show_Str(15,50,200,16, ATK-ESP ,,12,0); LCD_Fill(15,50,239,50+12,WHITE); // Show_Str_Mid(0,50,WK_UP: KEY0:ID0 KEY1:ID1 ,12,240); LCD_Fill(15,80,239,80+12,WHITE);
atk_8266_get_ip(15,65);//STA+AP , IP,
Show_Str(15,95,200,12,:,12,0);
Show_Str(15,110,200,12,STA :,12,0);
Show_Str(120+15,110,200,12,AP :,12,0); Show_Str(15,125,200,12,:,12,0); Show_Str(15,140,200,12,:,12,0);
atk_8266_wificonf_show(15,195,
:,(u8*)wifista_ssid,(u8*)wifista_encryption,(u8*)wifista_password); POINT_COLOR=BLUE;
Show_Str(48+15,110,200,12,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro&0X03],12,0); //STA
// //STA //AP // //
Show_Str(162+15,110,200,12,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro>>4],12,0); //AP
USART2_RX_STA=0; while(1)
{
key=KEY_Scan(0); if(key==4)
{
res=0;
break; }
else if(key==1)
//WK_UP
/KEY0 ID0

{
sprintf((char*)p,ATK-8266 ID0 %02dr
,t/10); //
Show_Str(15+54,125,200,12,p,12,0); atk_8266_send_cmd(AT+CIPSEND=0,25,OK,200); //
delay_ms(200);
atk_8266_send_data(p,OK,100); // timex=100;
}
else if(key==2) //KEY1 ID1
{
{
sprintf((char*)p,ATK-8266 ID1 %02dr
,t/10);//
Show_Str(15+54,125,200,12,p,12,0); atk_8266_send_cmd(AT+CIPSEND=1,25,OK,200); //
delay_ms(200);
atk_8266_send_data(p,OK,100);
timex=100; }
if(timex)timex; if(timex==1)LCD_Fill(30+54,125,239,122,WHITE); t++;
delay_ms(10);
if(USART2_RX_STA&0X8000)
//
rlen=USART2_RX_STA&0X7FFF;
USART2_RX_BUF[rlen]=0;
printf(%s,USART2_RX_BUF);
sprintf((char*)p,%d ,,rlen); // LCD_Fill(15+54,140,239,130,WHITE);
POINT_COLOR=BRED;
//
// //
//
//
Show_Str(15+54,140,156,12,p,12,0); // POINT_COLOR=BLUE;
LCD_Fill(15,155,239,319,WHITE); Show_Str(15,155,180,190,USART2_RX_BUF,12,0); // USART2_RX_STA=0;
if(constate!=+)t=1000; //,
else t=0; //,10 }
if(t==1000)// 10 ,. {
LCD_Fill(15+54,125,239,138,WHITE); LCD_Fill(15+54,95,120,110,WHITE);

constate=atk_8266_consta_check();// if(constate==+)Show_Str(15+54,95,200,12,,12,0); else Show_Str(15+54,95,200,12,,12,0);
t=0;
//
} if((t%20)==0)LED0=!LED0; atk_8266_at_response(1);
}
return res; }
myfree(p);
//
AP+STA (TCP TCP UDP) 1.1.4 3 9 STA AP TCP UDP IP IP
KEY0 ID0 KEY1 ID1 10 LCDDS0400msKEY_UP
apsta.c wifista.c :atk_8266_wifista_test:
//ATK-ESP8266 WIFI STA // TCP/UDP //:0, //,
u8 netpro=0; // u8 atk_8266_wifista_test(void)
{
//u8 netpro=0; // u8 key;
u8 timex=0;
u8 ipbuf[16];
u8 *p;
u16 t=999;
u8 res=0;
u16 rlen=0;
u8 constate=0;
p=mymalloc(32);
atk_8266_send_cmd(AT+CWMODE=1,OK,50); atk_8266_send_cmd(AT+RST,OK,20); //DHCP ( AP ) delay_ms(1000); // 3S delay_ms(1000);
//IP //
//
// 32 // WIFI STA

delay_ms(1000);
delay_ms(1000);
// WIFI //,
!! sprintf((char*)p,AT+CWJAP=%s,%s,wifista_ssid,wifista_password); //:ssid,
while(atk_8266_send_cmd(p,WIFI GOT IP,300)); //, IP
PRESTA: netpro|=atk_8266_netpro_sel(50,30,(u8*)ATK_ESP8266_CWMODE_TBL[0]); //
if(netpro&0X02) //UDP {
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); if(atk_8266_ip_set(WIFI-STA UDP IP
,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro],(u8*)portnum,ipbuf))goto PRESTA; //IP
} else {
delay_ms(200);
LCD_Clear(WHITE); while(atk_8266_send_cmd(p,OK,500));
//TCP
if(netpro&0X01) {
sprintf((char*)p,AT+CIPSTART=UDP,%s,%s,ipbuf,(u8*)portnum); // UDP
delay_ms(200);
atk_8266_send_cmd(AT+CIPMUX=0,OK,20);
//
//TCP Client
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); if(atk_8266_ip_set(WIFI-STA IP
,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro],(u8*)portnum,ipbuf))goto PRESTA; //IP
atk_8266_send_cmd(AT+CIPMUX=0,OK,20); //0:1: sprintf((char*)p,AT+CIPSTART=TCP,%s,%s,ipbuf,(u8*)portnum); // TCP
while(atk_8266_send_cmd(p,OK,200))

{
LCD_Clear(WHITE);
POINT_COLOR=RED; Show_Str_Mid(0,40,WK_UP:,16,240); Show_Str(30,80,200,12,ATK-ESP TCP ,12,0); //
key=KEY_Scan(0);
if(key==4)goto PRESTA;
} atk_8266_send_cmd(AT+CIPMODE=1,OK,200); //:
} }
} else {
//TCP Server
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0); atk_8266_send_cmd(AT+CIPMUX=1,OK,20); //0:1: sprintf((char*)p,AT+CIPSERVER=1,%s,(u8*)portnum);
// Server (0;1) portnum atk_8266_send_cmd(p,OK,50);
LCD_Clear(WHITE);
POINT_COLOR=RED;
Show_Str_Mid(0,30,ATK-ESP WIFI-STA ,16,240); Show_Str(30,50,200,16, ATK-ESP ,,12,0);
LCD_Fill(30,50,239,50+12,WHITE); // Show_Str(30,50,200,16,WK_UP: KEY0:,12,0);
LCD_Fill(30,80,239,80+12,WHITE);
atk_8266_get_wanip(ipbuf); //, WAN IP sprintf((char*)p,IP :%s :%s,ipbuf,(u8*)portnum);
Show_Str(30,65,200,12,p,12,0); Show_Str(30,80,200,12,:,12,0); Show_Str(120,80,200,12,:,12,0); Show_Str(30,100,200,12,:,12,0); Show_Str(30,115,200,12,:,12,0); atk_8266_wificonf_show(30,180,
:,(u8*)wifista_ssid,(u8*)wifista_encryption,(u8*)wifista_password); POINT_COLOR=BLUE;
// IP // // // //

Show_Str(120+30,80,200,12,(u8*)ATK_ESP8266_WORKMODE_TBL[netpro],12,0); //
USART2_RX_STA=0; while(1)
{
key=KEY_Scan(0); if(key==4)
{
//WK_UP
res=0;
atk_8266_quit_trans(); // atk_8266_send_cmd(AT+CIPMODE=0,OK,20);
//
break; }
else if(key==1) //KEY0 {
if((netpro==3)||(netpro==2)) //UDP {
sprintf((char*)p,ATK-8266%s %02dr
,ATK_ESP8266_WORKMODE_TBL[netpro],t/10);
//
Show_Str(30+54,100,200,12,p,12,0); atk_8266_send_cmd(AT+CIPSEND=25,OK,200); //
delay_ms(200);
atk_8266_send_data(p,OK,100); //
timex=100; }
else if((netpro==1)) //TCP Client {
atk_8266_quit_trans(); atk_8266_send_cmd(AT+CIPSEND,OK,20);
//
sprintf((char*)p,ATK-8266%s %dr
,ATK_ESP8266_WORKMODE_TBL[netpro],t/10);
//
//
} else {
Show_Str(30+54,100,200,12,p,12,0); u2_printf(%s,p);
timex=100;
//TCP Server
sprintf((char*)p,ATK-8266%s %02dr
,ATK_ESP8266_WORKMODE_TBL[netpro],t/10);
Show_Str(30+54,100,200,12,p,12,0);

atk_8266_send_cmd(AT+CIPSEND=0,25,OK,200); //
delay_ms(200);
atk_8266_send_data(p,OK,100); // timex=100;
} }else;
if(timex)timex; if(timex==1)LCD_Fill(30+54,100,239,112,WHITE); t++;
delay_ms(10);
if(USART2_RX_STA&0X8000) // {
rlen=USART2_RX_STA&0X7FFF; //
USART2_RX_BUF[rlen]=0; // printf(%s,USART2_RX_BUF); // sprintf((char*)p,%d ,,rlen);// LCD_Fill(30+54,115,239,130,WHITE);
POINT_COLOR=BRED; Show_Str(30+54,115,156,12,p,12,0); // POINT_COLOR=BLUE; LCD_Fill(30,130,239,319,WHITE); Show_Str(30,130,180,190,USART2_RX_BUF,12,0); //
USART2_RX_STA=0;
if(constate!=+)t=1000; //, else t=0; //,10
}
if(t==1000)// 10 ,. {
myfree(p);
return res; }
//
constate=atk_8266_consta_check();// if(constate==+)Show_Str(30+30,80,200,12,,12,0); //
else Show_Str(30+30,80,200,12,,12,0);
t=0; }
if((t%20)==0)LED0=!LED0;
atk_8266_at_response(1); }

apsta.c AP apsta.c 3 (TCP TCP UDP) WIFI WIFI
WIFI SSID :ALIENTEK; :WPA/WPA2_AES;:15902020353
wifista.c wifiap.c :atk_8266_wifiap_test:
//WIFI STA ,,,.
const u8* wifista_ssid=ALIENTEK;
const u8* wifista_encryption=wpawpa2_aes; const u8* wifista_password=15902020353;
// SSID //wpa/wpa2 aes //
//ATK-ESP8266 WIFI AP // TCP/UDP //:0,
// ,
u8 atk_8266_wifiap_test(void) {
u8 netpro=0; u8 key;
u8 timex=0; u8 ipbuf[16]; u8 *p;
return res; }
//
//IP //
// 32 //
u16 t=999;
u8 res=0;
u16 rlen=0;
u8 constate=0; p=mymalloc(SRAMIN,32);
//
STA AT+CWSAP :wifiap_ssid,wifiap_encryption,wifiap_password common.c :
//WIFI AP ,,.
const u8* wifiap_ssid=ATK-ESP8266;
const u8* wifiap_encryption=wpawpa2_aes;
const u8* wifiap_password=12345678;
SSID :ATK-ESP8266;:
WPA/WPA2_AES;:12345678
AP(COM-WIFI AP)(TCP
TCP UDP) 1.1.2 3
// SSID //wpa/wpa2 aes //

IP IP
STA(COM-STA)
wifista.c test.c main main
:
int main(void) {
u8 key,fontok=0; Stm32_Clock_Init(9); delay_init(72); uart_init(72,115200); USART2_Init(36,115200);
// // // 1
// 3
LCD_Init(); LED_Init(); KEY_Init(); usmart_dev.init(72); TP_Init();
mem_init(); exfuns_init(); f_mount(fs[0],0:,1); f_mount(fs[1],1:,1); key=KEY_Scan(0); if(key==KEY0_PRES) {
LCD_Clear(WHITE); TP_Adjust(); TP_Save_Adjdata(); LCD_Clear(WHITE);
//
//LED
//
//usmart // //
// fatfs // SD
// FLASH. //
// //
//
// OK
// //
}
fontok=font_init(); if(fontok||key==KEY1_PRES) {
LCD_Clear(WHITE);
POINT_COLOR=RED; // LCD_ShowString(60,50,200,16,16,ALIENTEK STM32); while(SD_Initialize()) // SD
{
LCD_ShowString(60,70,200,16,16,SD Card Failed!); delay_ms(200); LCD_Fill(60,70,200+60,70+16,WHITE); delay_ms(200);
}
LCD_ShowString(60,70,200,16,16,SD Card OK); LCD_ShowString(60,90,200,16,16,Font Updating); key=update_font(20,110,16); //

while(key) // {
LCD_ShowString(60,110,200,16,16,Font Update Failed!); delay_ms(200);
LCD_Fill(20,110,200+20,110+16,WHITE);
delay_ms(200);
}
LCD_ShowString(60,110,200,16,16,Font Update Success!); delay_ms(1500);
LCD_Clear(WHITE); //
}
atk_8266_test(); // ATK_ESP8266 }
ATK-ESP8266 3(:115200) 12*12 16*16 UNICODE GBK main KEY0; KEY1
atk_8266_test 2(:115200) atk_8266_test ATK-ESP8266ATK- ESP8266( STA(COM-WIFI STA) AP(COM-WIFI AP) AP+STA(COM-WIFI AP+STA))
USMART atk_8266_send_cmd atk_8266_quit_trans 1 ATK-ESP8266
() WIFI :atk_8266_send_cmd(AT+CWSAP?,OK,20) AP WIFI :atk_8266_send_cmd(AT+CIFSR,OK,20), IP 3.2 :

4
3.2 USMART ATK-ESP8266
3 3 : WIFI(COM-AP) STA(COM-STA) AP+STA(COM-AP+STA)
Mini STM32F103 : 2.3.1
10s ( ) LCD 4.1 :

4.1 WIFI
KEY0 AP+STA(COM-AP+STA) KEY1 STA(COM-STA) KEY_UP AP (COM-AP)
4.1 STA(COM-STA)
STAWIFI STA WIFI DHCP WIFI WIFI ( )/
STA : WIFI <> WIFI ATK-ESP8266 (WIFI STA)
WIFI
WIFI ( 4.1) KEY1 STA(COM- STA) 3 :TCP TCP UDP KEY0/KEY1 KEY_UP 4.1.1

4.1.1 4.1.1 STA TCP
TCP KEY_UP TCP 4.1.1.1 :
4.1.1.1 STA TCP
4.1.1.1 IP :192.168.1.125:8086 TCP:TCP Client192.168.1.125:8086
TCPTCP Client TCP Client:3 .exe:TCP Client; IP :192.168.1.125;

:8086 ATK-ESP8266 4.1.1.2 :
4.1.1.2
4.1.1.2 ATK-ESP8266 KEY0 4.1.1.3 :

4.1.1.3 TCP
4.1.1.4 :
4.1.1.4

4.1.2 STA TCP
TCP KEY_UP TCP TCP IP IP :8086 IP IP 4.1.2.1 :
4.1.2.1 IP
IP :192.168.1.127 IP
:192.168.1.127 4.1.2.2 :

4.1.2.2 IP
4.1.2.2 IP IP
( 5s) TCP 4.1.2.3 :
4.1.2.3 TCP
TCP
:TCP Server; IP :192.168.1.127( IP );:8086; TCP 4.1.2.4 :

4.1.2.4
TCP TCP
4.1.2.5 KEY0
4.1.2.5 TCP
4.1.2.5 TCP
4.1.2.6 :
4.1.2.6 TCP

4.1.3 STA UDP
UDP KEY_UP UDP UDP TCP UDP 4.1.3.1 :
4.1.3.1 UDP 4.2 AP(COM-AP)
AP WIFI AP DHCP WIFI ( ) WIFI WIFI android
:ATK-ESP8266 (WIFI AP) (WIFI STA) WIFI WIFI AP WIFI STA
WIFI ( 4.1) KEY_UP AP(COM- AP) 3 :TCP TCP UDP 4.1.1
4.2.1 AP TCP
TCP KEY_UP TCP WIFI AP SSID :ATK-ESP8266;:wpawpa2_aes;:12345678 IP (TCP IP ):192.168.4.1;:8086; TCP 4.2.1.1 :

4.2.1.1 TCP
TCP IP :192.168.4.1:8086 TCP Client : WIFI WLAN WLAN :ATK-ESP8266 SSID:12345678 4.3.1.2 :
4.2.1.2 ATK-ESP8266 WIFI ATK-ESP8266 4.2.1.3 :

4.2.1.3
IP :192.168.4.2
:3( ).apk :1.tcp client2. 3. IP 4.5. 4.2.1.4 :
4.2.1.4 TCP Client TCP : 4.2.1.4 IP/
port:8086 disconnect

4.2.1.5 4.2.1.6
4.2.1.5 TCP
4.2.1.6 TCP 4.2.2 AP TCP
WIFI APTCPKEY_UP TCP WIFI WLAN ATK-ESP8266:1.tcp server2. 3. :80864. 4.2.2.1 :

4.2.2.1 TCP Server :TCP ServerIP
(192.168.4.2) TCP IP IP IP:192.168. 4.2IP(5s) TCP 4.2.2.1 :
4.2.2.2 TCP IP
4.2.2.2 4.2.2.3 :

4.2.2.3 TCP 4.2.3 AP UDP
UDP KEY_UP UDP UDP TCP UDP 4.1.3.1 :
4.2.3.1 UDP IP 4.3 AP+STA(COM-AP+STA)
AP STA AP( WIFI ATK_ESP8288 ) STA wifi AP STA 9 3
WIFI ( 4.1) KEY0 AP+STA(COM- AP+STA) STA 3 :TCP TCP

UDP TCP STA AP 4.3.1
4.3.1 STA TCP 4.3.1 AP TCP STA TCP
STA TCP AP TCP AP TCP +STA TCP AP IP:192.168.4.1;STA IP:192.168.1.xxxxx SSID ATK_ESP8266 wifi 192.168.4.18086 :0,CONNECT; ID 0 192.168.1.xxxxx8086:1,CONNECT; ID 1AP+STA ID :
4.3.1.1 AP TCP

4.3.1.2
4.3.1.3 KEY0 KEY1
4.3.1.4.1 4.3.1.4.2:

4.3.1.4.1
4.3.1.4.1

+IPD,0 ID0 +IPD,1 ID1 4.3.1.5:
4.3.1.5 . 4.3.2 AP TCP STA TCP
STA TCP AP TCP TCP ServerIPSSID ATK_ESP8266 wifi TCP Server 4.2.2 TCP Server IP:192.168.4.2 4.3.2.1 :
4.3.2.1 AP TCP Client TCP Server

STA IP: 192.168.1.XXXXX;:8086 4.3.1 :
4.3.2.2 ID1
4.3.2.3 4.3.3 AP UDP STA TCP
STA TCP AP UDP TCP Server IP SSID ATK_ESP8266 wifi UDP Server 4.2.2 UDP Server IP:192.168.4.2 4.3.2.1

4.3.2.1 UDP Server IP
UDP 4.3.2.2 STA IP:192.168.1.XXX:8086KEY0KEY1
4.3.2.3:
4.3.2.3

4.3.2.4:
4.3.2.4

5 :http://www.alientek.com
:http://www.openedv.com :https://openedv.taobao.com :[email protected] :[email protected] : 906 :020-38271790

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] android AN1509 ATK-ESP8266 WIFI
$25