![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
แก้ให้แล้ว
Dependencies: NOKIA_5110 mbed
Fork of Lost-Found_BOX by
Diff: myESP.h
- Revision:
- 8:e683edc8a530
- Parent:
- 7:725f5fb7e3a3
--- a/myESP.h Mon Dec 07 14:43:15 2015 +0000 +++ b/myESP.h Mon Dec 07 18:12:36 2015 +0000 @@ -40,6 +40,7 @@ timeout = 2; getreply(); pc.printf(buf); + wait(1); /* Error checking is not required */ /* @@ -58,21 +59,21 @@ buffer += "\"\r\n"; esp.printf(buffer.c_str()); - timeout = 6; + timeout = 7; getreply(); pc.printf(buf); - // wait(1); + wait(1); esp.printf("AT+CIPMUX=1\r\n"); - timeout =3; + timeout =1; getreply(); pc.printf("Open Multi Connection : %s\n",buf); - //wait(1); + wait(1); pc.printf("\n---------- Get IP's ----------\r\n"); char aa[]= "AT+CIFSR\r\n"; esp.printf(aa); - timeout=3; + timeout=1; getreply(); pc.printf(buf); @@ -86,7 +87,7 @@ void getStatus(const char domain[],const char dir[],char id[]){ pc.printf("Start Get Status\n"); esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); - timeout=5; + timeout=1; getreply(); pc.printf(buf); //wait(1); @@ -103,7 +104,7 @@ strcat(snd,buffer); strcat(snd,"\r\n"); SendCMD(); - timeout=3; + timeout=1; getreply(); pc.printf(buf); //wait(2); @@ -111,7 +112,7 @@ pc.printf("Start point to url...\n"); strcpy(snd,cmd); SendCMD(); - timeout=5; + timeout=2; getreply(); pc.printf(buf); @@ -129,7 +130,7 @@ pc.printf("--Extract status from http--\n"); pc.printf("UID : %s\n",id); esp.printf("AT+CIPCLOSE=0\r\n"); - timeout=3; + timeout=1; getreply(); pc.printf(buf); } @@ -142,11 +143,11 @@ pc.printf("Start HTTP Request\n"); esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); - timeout=5; + timeout=1; getreply(); pc.printf(buf); - wait(1); + //wait(1); char cmd[128] = "GET http://"; strcat(cmd,domain); @@ -166,15 +167,15 @@ SendCMD(); - timeout=3; + timeout=1; getreply(); pc.printf(buf); - wait(1); + //wait(1); pc.printf("Start point to url...\n"); strcpy(snd,cmd); SendCMD(); - timeout=3; + timeout=2; getreply(); pc.printf(buf); char* data; @@ -195,17 +196,17 @@ pc.printf("Tel : %s : %d\n",tel,strlen(tel)); esp.printf("AT+CIPCLOSE=0\r\n"); - timeout=3; + timeout=1; getreply(); pc.printf(buf); } //http://localhost/l-f-box/update.php?key=fra221a0636&uid=11&withdrawer=57340500000 -void updateWithdrawer(const char domain[],const char dir[],char withdrawer[],char uid[]){ +void updateWithdrawer(const char domain[],const char dir[],char withdrawer[]){ pc.printf("Start HTTP Request\n"); esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); - timeout=5; + timeout=1; getreply(); pc.printf(buf); @@ -215,8 +216,6 @@ strcat(cmd,domain); strcat(cmd,dir); strcat(cmd,"?key=fra221a0636"); - strcat(cmd,"&uid="); - strcat(cmd,uid); strcat(cmd,"&withdrawer="); strcat(cmd,withdrawer); @@ -234,15 +233,15 @@ SendCMD(); - timeout=5; + timeout=1; getreply(); pc.printf(buf); - wait(2); + wait(1); pc.printf("Start point to url...\n"); strcpy(snd,cmd); SendCMD(); - timeout=5; + timeout=3; getreply(); pc.printf(buf); } @@ -251,7 +250,7 @@ void newDepositor(const char domain[],const char dir[],char depositor[]){ pc.printf("Start HTTP Request\n"); esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); - timeout=5; + timeout=2; getreply(); pc.printf(buf); @@ -278,15 +277,15 @@ SendCMD(); - timeout=5; + timeout=1; getreply(); pc.printf(buf); - wait(2); + wait(1); pc.printf("Start point to url...\n"); strcpy(snd,cmd); SendCMD(); - timeout=5; + timeout=3; getreply(); pc.printf(buf); } \ No newline at end of file