แก้ให้แล้ว
Dependencies: NOKIA_5110 mbed
Fork of Lost-Found_BOX by
myESP.h@8:e683edc8a530, 2015-12-07 (annotated)
- Committer:
- mustwillza
- Date:
- Mon Dec 07 18:12:36 2015 +0000
- Revision:
- 8:e683edc8a530
- Parent:
- 7:725f5fb7e3a3
Completed without ; Solenoid & LDR
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mustwillza | 7:725f5fb7e3a3 | 1 | #include "mbed.h" |
mustwillza | 7:725f5fb7e3a3 | 2 | #include <string> |
mustwillza | 7:725f5fb7e3a3 | 3 | |
mustwillza | 7:725f5fb7e3a3 | 4 | extern Serial pc; |
mustwillza | 7:725f5fb7e3a3 | 5 | extern Serial esp; //tx rx |
mustwillza | 7:725f5fb7e3a3 | 6 | int count,ended,timeout; |
mustwillza | 7:725f5fb7e3a3 | 7 | char buf[1024]; //reply buffer for esp8266 |
mustwillza | 7:725f5fb7e3a3 | 8 | char snd[256]; |
mustwillza | 7:725f5fb7e3a3 | 9 | Timer t; //Timeout comparison for get reply ESP8266 |
mustwillza | 7:725f5fb7e3a3 | 10 | |
mustwillza | 7:725f5fb7e3a3 | 11 | void SendCMD() |
mustwillza | 7:725f5fb7e3a3 | 12 | { |
mustwillza | 7:725f5fb7e3a3 | 13 | esp.printf("%s", snd); |
mustwillza | 7:725f5fb7e3a3 | 14 | } |
mustwillza | 7:725f5fb7e3a3 | 15 | |
mustwillza | 7:725f5fb7e3a3 | 16 | |
mustwillza | 7:725f5fb7e3a3 | 17 | void getreply() |
mustwillza | 7:725f5fb7e3a3 | 18 | { |
mustwillza | 7:725f5fb7e3a3 | 19 | memset(buf, '\0', sizeof(buf)); |
mustwillza | 7:725f5fb7e3a3 | 20 | t.start(); |
mustwillza | 7:725f5fb7e3a3 | 21 | ended=0;count=0; |
mustwillza | 7:725f5fb7e3a3 | 22 | while(!ended) { |
mustwillza | 7:725f5fb7e3a3 | 23 | if(esp.readable()) { |
mustwillza | 7:725f5fb7e3a3 | 24 | buf[count] = esp.getc();count++; |
mustwillza | 7:725f5fb7e3a3 | 25 | } |
mustwillza | 7:725f5fb7e3a3 | 26 | if(t.read() > timeout) { |
mustwillza | 7:725f5fb7e3a3 | 27 | ended = 1;t.stop();t.reset(); |
mustwillza | 7:725f5fb7e3a3 | 28 | } |
mustwillza | 7:725f5fb7e3a3 | 29 | } |
mustwillza | 7:725f5fb7e3a3 | 30 | } |
mustwillza | 7:725f5fb7e3a3 | 31 | |
mustwillza | 7:725f5fb7e3a3 | 32 | |
mustwillza | 7:725f5fb7e3a3 | 33 | int setupESP(string ssid,string password) |
mustwillza | 7:725f5fb7e3a3 | 34 | { |
mustwillza | 7:725f5fb7e3a3 | 35 | pc.printf("Sending Reset CMD\n"); |
mustwillza | 7:725f5fb7e3a3 | 36 | esp.printf("AT+RST\r\n"); /* reset module */ |
mustwillza | 7:725f5fb7e3a3 | 37 | wait(3); |
mustwillza | 7:725f5fb7e3a3 | 38 | |
mustwillza | 7:725f5fb7e3a3 | 39 | esp.printf("AT+CWMODE=1\r\n"); /* configure as access point */ |
mustwillza | 7:725f5fb7e3a3 | 40 | timeout = 2; |
mustwillza | 7:725f5fb7e3a3 | 41 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 42 | pc.printf(buf); |
mustwillza | 8:e683edc8a530 | 43 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 44 | /* Error checking is not required */ |
mustwillza | 7:725f5fb7e3a3 | 45 | |
mustwillza | 7:725f5fb7e3a3 | 46 | /* |
mustwillza | 7:725f5fb7e3a3 | 47 | pc.printf("Access Point List!\n"); |
mustwillza | 7:725f5fb7e3a3 | 48 | esp.printf("AT+CWLAP\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 49 | timeout = 5; |
mustwillza | 7:725f5fb7e3a3 | 50 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 51 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 52 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 53 | */ |
mustwillza | 7:725f5fb7e3a3 | 54 | |
mustwillza | 7:725f5fb7e3a3 | 55 | string buffer("AT+CWJAP=\""); |
mustwillza | 7:725f5fb7e3a3 | 56 | buffer += ssid; |
mustwillza | 7:725f5fb7e3a3 | 57 | buffer += "\",\""; |
mustwillza | 7:725f5fb7e3a3 | 58 | buffer += password; |
mustwillza | 7:725f5fb7e3a3 | 59 | buffer += "\"\r\n"; |
mustwillza | 7:725f5fb7e3a3 | 60 | |
mustwillza | 7:725f5fb7e3a3 | 61 | esp.printf(buffer.c_str()); |
mustwillza | 8:e683edc8a530 | 62 | timeout = 7; |
mustwillza | 7:725f5fb7e3a3 | 63 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 64 | pc.printf(buf); |
mustwillza | 8:e683edc8a530 | 65 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 66 | |
mustwillza | 7:725f5fb7e3a3 | 67 | esp.printf("AT+CIPMUX=1\r\n"); |
mustwillza | 8:e683edc8a530 | 68 | timeout =1; |
mustwillza | 7:725f5fb7e3a3 | 69 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 70 | pc.printf("Open Multi Connection : %s\n",buf); |
mustwillza | 8:e683edc8a530 | 71 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 72 | |
mustwillza | 7:725f5fb7e3a3 | 73 | pc.printf("\n---------- Get IP's ----------\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 74 | char aa[]= "AT+CIFSR\r\n"; |
mustwillza | 7:725f5fb7e3a3 | 75 | esp.printf(aa); |
mustwillza | 8:e683edc8a530 | 76 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 77 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 78 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 79 | |
mustwillza | 7:725f5fb7e3a3 | 80 | //wait(1); |
mustwillza | 7:725f5fb7e3a3 | 81 | |
mustwillza | 7:725f5fb7e3a3 | 82 | return 1; |
mustwillza | 7:725f5fb7e3a3 | 83 | } |
mustwillza | 7:725f5fb7e3a3 | 84 | |
mustwillza | 7:725f5fb7e3a3 | 85 | //Domain 192.168.1.88 |
mustwillza | 7:725f5fb7e3a3 | 86 | // directory : /l-f-box/getdata.php?check=1 |
mustwillza | 7:725f5fb7e3a3 | 87 | void getStatus(const char domain[],const char dir[],char id[]){ |
mustwillza | 7:725f5fb7e3a3 | 88 | pc.printf("Start Get Status\n"); |
mustwillza | 7:725f5fb7e3a3 | 89 | esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); |
mustwillza | 8:e683edc8a530 | 90 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 91 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 92 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 93 | //wait(1); |
mustwillza | 7:725f5fb7e3a3 | 94 | |
mustwillza | 7:725f5fb7e3a3 | 95 | char cmd[128] = "GET http://"; |
mustwillza | 7:725f5fb7e3a3 | 96 | strcat(cmd,domain); |
mustwillza | 7:725f5fb7e3a3 | 97 | strcat(cmd,dir); |
mustwillza | 7:725f5fb7e3a3 | 98 | |
mustwillza | 7:725f5fb7e3a3 | 99 | char buffer[2] = ""; |
mustwillza | 7:725f5fb7e3a3 | 100 | strcat(cmd," HTTP/1.0\r\n\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 101 | sprintf(buffer , "%d",strlen(cmd) ); |
mustwillza | 7:725f5fb7e3a3 | 102 | |
mustwillza | 7:725f5fb7e3a3 | 103 | strcpy(snd,"AT+CIPSEND=0,"); |
mustwillza | 7:725f5fb7e3a3 | 104 | strcat(snd,buffer); |
mustwillza | 7:725f5fb7e3a3 | 105 | strcat(snd,"\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 106 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 107 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 108 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 109 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 110 | //wait(2); |
mustwillza | 7:725f5fb7e3a3 | 111 | |
mustwillza | 7:725f5fb7e3a3 | 112 | pc.printf("Start point to url...\n"); |
mustwillza | 7:725f5fb7e3a3 | 113 | strcpy(snd,cmd); |
mustwillza | 7:725f5fb7e3a3 | 114 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 115 | timeout=2; |
mustwillza | 7:725f5fb7e3a3 | 116 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 117 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 118 | |
mustwillza | 7:725f5fb7e3a3 | 119 | char* data2; |
mustwillza | 7:725f5fb7e3a3 | 120 | pc.printf("Declare data2 \n"); |
mustwillza | 7:725f5fb7e3a3 | 121 | data2 = strstr(buf,"</st>"); |
mustwillza | 7:725f5fb7e3a3 | 122 | pc.printf("Strstr </st> : %s\n",data2); |
mustwillza | 7:725f5fb7e3a3 | 123 | data2 = data2+6; |
mustwillza | 7:725f5fb7e3a3 | 124 | pc.printf("Shift +5 : %s\n",data2); |
mustwillza | 7:725f5fb7e3a3 | 125 | id[0] = data2[0]; |
mustwillza | 7:725f5fb7e3a3 | 126 | id[1] = data2[1]; |
mustwillza | 7:725f5fb7e3a3 | 127 | id[2] = '\0'; |
mustwillza | 7:725f5fb7e3a3 | 128 | pc.printf(id); |
mustwillza | 7:725f5fb7e3a3 | 129 | |
mustwillza | 7:725f5fb7e3a3 | 130 | pc.printf("--Extract status from http--\n"); |
mustwillza | 7:725f5fb7e3a3 | 131 | pc.printf("UID : %s\n",id); |
mustwillza | 7:725f5fb7e3a3 | 132 | esp.printf("AT+CIPCLOSE=0\r\n"); |
mustwillza | 8:e683edc8a530 | 133 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 134 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 135 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 136 | } |
mustwillza | 7:725f5fb7e3a3 | 137 | |
mustwillza | 7:725f5fb7e3a3 | 138 | |
mustwillza | 7:725f5fb7e3a3 | 139 | // domain : 192.168.1.88 |
mustwillza | 7:725f5fb7e3a3 | 140 | // directory : /l-f-box/getdata.php?rfid= |
mustwillza | 7:725f5fb7e3a3 | 141 | // value : 1 |
mustwillza | 7:725f5fb7e3a3 | 142 | void getDataHTTP(const char domain[],const char dir[],const char value[],char uid[] , char name[] ,char tel[]){ |
mustwillza | 7:725f5fb7e3a3 | 143 | |
mustwillza | 7:725f5fb7e3a3 | 144 | pc.printf("Start HTTP Request\n"); |
mustwillza | 7:725f5fb7e3a3 | 145 | esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); |
mustwillza | 8:e683edc8a530 | 146 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 147 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 148 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 149 | |
mustwillza | 8:e683edc8a530 | 150 | //wait(1); |
mustwillza | 7:725f5fb7e3a3 | 151 | |
mustwillza | 7:725f5fb7e3a3 | 152 | char cmd[128] = "GET http://"; |
mustwillza | 7:725f5fb7e3a3 | 153 | strcat(cmd,domain); |
mustwillza | 7:725f5fb7e3a3 | 154 | strcat(cmd,dir); |
mustwillza | 7:725f5fb7e3a3 | 155 | strcat(cmd,value); |
mustwillza | 7:725f5fb7e3a3 | 156 | //="GET http://%s%s%s",domain,dir,value; |
mustwillza | 7:725f5fb7e3a3 | 157 | char buffer[2] = ""; |
mustwillza | 7:725f5fb7e3a3 | 158 | strcat(cmd," HTTP/1.0\r\n\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 159 | sprintf(buffer , "%d",strlen(cmd) ); |
mustwillza | 7:725f5fb7e3a3 | 160 | |
mustwillza | 7:725f5fb7e3a3 | 161 | strcpy(snd,"AT+CIPSEND=0,"); |
mustwillza | 7:725f5fb7e3a3 | 162 | strcat(snd,buffer); |
mustwillza | 7:725f5fb7e3a3 | 163 | strcat(snd,"\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 164 | pc.printf("%d %d",strlen(cmd) ,strlen(snd)); |
mustwillza | 7:725f5fb7e3a3 | 165 | pc.printf(snd); |
mustwillza | 7:725f5fb7e3a3 | 166 | pc.printf(cmd); |
mustwillza | 7:725f5fb7e3a3 | 167 | |
mustwillza | 7:725f5fb7e3a3 | 168 | |
mustwillza | 7:725f5fb7e3a3 | 169 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 170 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 171 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 172 | pc.printf(buf); |
mustwillza | 8:e683edc8a530 | 173 | //wait(1); |
mustwillza | 7:725f5fb7e3a3 | 174 | |
mustwillza | 7:725f5fb7e3a3 | 175 | pc.printf("Start point to url...\n"); |
mustwillza | 7:725f5fb7e3a3 | 176 | strcpy(snd,cmd); |
mustwillza | 7:725f5fb7e3a3 | 177 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 178 | timeout=2; |
mustwillza | 7:725f5fb7e3a3 | 179 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 180 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 181 | char* data; |
mustwillza | 7:725f5fb7e3a3 | 182 | |
mustwillza | 7:725f5fb7e3a3 | 183 | data = strstr(buf,"</data>"); |
mustwillza | 7:725f5fb7e3a3 | 184 | data = data+7; |
mustwillza | 7:725f5fb7e3a3 | 185 | data = strtok(data,";"); |
mustwillza | 7:725f5fb7e3a3 | 186 | strcpy(uid,data); |
mustwillza | 7:725f5fb7e3a3 | 187 | data = strtok(NULL,";"); |
mustwillza | 7:725f5fb7e3a3 | 188 | strcpy(name,data); |
mustwillza | 7:725f5fb7e3a3 | 189 | data = strtok(NULL,";"); |
mustwillza | 7:725f5fb7e3a3 | 190 | strcpy(tel,data); |
mustwillza | 7:725f5fb7e3a3 | 191 | |
mustwillza | 7:725f5fb7e3a3 | 192 | pc.printf("--Extract data from http--\n"); |
mustwillza | 7:725f5fb7e3a3 | 193 | |
mustwillza | 7:725f5fb7e3a3 | 194 | pc.printf("ID : %s : %d\n",uid,strlen(uid)); |
mustwillza | 7:725f5fb7e3a3 | 195 | pc.printf("Name : %s : %d\n",name,strlen(name)); |
mustwillza | 7:725f5fb7e3a3 | 196 | pc.printf("Tel : %s : %d\n",tel,strlen(tel)); |
mustwillza | 7:725f5fb7e3a3 | 197 | |
mustwillza | 7:725f5fb7e3a3 | 198 | esp.printf("AT+CIPCLOSE=0\r\n"); |
mustwillza | 8:e683edc8a530 | 199 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 200 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 201 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 202 | } |
mustwillza | 7:725f5fb7e3a3 | 203 | |
mustwillza | 7:725f5fb7e3a3 | 204 | |
mustwillza | 7:725f5fb7e3a3 | 205 | //http://localhost/l-f-box/update.php?key=fra221a0636&uid=11&withdrawer=57340500000 |
mustwillza | 8:e683edc8a530 | 206 | void updateWithdrawer(const char domain[],const char dir[],char withdrawer[]){ |
mustwillza | 7:725f5fb7e3a3 | 207 | pc.printf("Start HTTP Request\n"); |
mustwillza | 7:725f5fb7e3a3 | 208 | esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); |
mustwillza | 8:e683edc8a530 | 209 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 210 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 211 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 212 | |
mustwillza | 7:725f5fb7e3a3 | 213 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 214 | |
mustwillza | 7:725f5fb7e3a3 | 215 | char cmd[128] = "GET http://"; |
mustwillza | 7:725f5fb7e3a3 | 216 | strcat(cmd,domain); |
mustwillza | 7:725f5fb7e3a3 | 217 | strcat(cmd,dir); |
mustwillza | 7:725f5fb7e3a3 | 218 | strcat(cmd,"?key=fra221a0636"); |
mustwillza | 7:725f5fb7e3a3 | 219 | strcat(cmd,"&withdrawer="); |
mustwillza | 7:725f5fb7e3a3 | 220 | strcat(cmd,withdrawer); |
mustwillza | 7:725f5fb7e3a3 | 221 | |
mustwillza | 7:725f5fb7e3a3 | 222 | //="GET http://%s%s%s",domain,dir,value; |
mustwillza | 7:725f5fb7e3a3 | 223 | char buffer[2] = ""; |
mustwillza | 7:725f5fb7e3a3 | 224 | strcat(cmd," HTTP/1.0\r\n\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 225 | sprintf(buffer , "%d",strlen(cmd) ); |
mustwillza | 7:725f5fb7e3a3 | 226 | |
mustwillza | 7:725f5fb7e3a3 | 227 | strcpy(snd,"AT+CIPSEND=0,"); |
mustwillza | 7:725f5fb7e3a3 | 228 | strcat(snd,buffer); |
mustwillza | 7:725f5fb7e3a3 | 229 | strcat(snd,"\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 230 | pc.printf("%d %d",strlen(cmd) ,strlen(snd)); |
mustwillza | 7:725f5fb7e3a3 | 231 | pc.printf(snd); |
mustwillza | 7:725f5fb7e3a3 | 232 | pc.printf(cmd); |
mustwillza | 7:725f5fb7e3a3 | 233 | |
mustwillza | 7:725f5fb7e3a3 | 234 | |
mustwillza | 7:725f5fb7e3a3 | 235 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 236 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 237 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 238 | pc.printf(buf); |
mustwillza | 8:e683edc8a530 | 239 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 240 | |
mustwillza | 7:725f5fb7e3a3 | 241 | pc.printf("Start point to url...\n"); |
mustwillza | 7:725f5fb7e3a3 | 242 | strcpy(snd,cmd); |
mustwillza | 7:725f5fb7e3a3 | 243 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 244 | timeout=3; |
mustwillza | 7:725f5fb7e3a3 | 245 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 246 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 247 | } |
mustwillza | 7:725f5fb7e3a3 | 248 | |
mustwillza | 7:725f5fb7e3a3 | 249 | //http://localhost/l-f-box/update.php?key=fra221a0636&uid=11&withdrawer=57340500000 |
mustwillza | 7:725f5fb7e3a3 | 250 | void newDepositor(const char domain[],const char dir[],char depositor[]){ |
mustwillza | 7:725f5fb7e3a3 | 251 | pc.printf("Start HTTP Request\n"); |
mustwillza | 7:725f5fb7e3a3 | 252 | esp.printf("AT+CIPSTART=0,\"TCP\",\"%s\",80\r\n",domain); |
mustwillza | 8:e683edc8a530 | 253 | timeout=2; |
mustwillza | 7:725f5fb7e3a3 | 254 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 255 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 256 | |
mustwillza | 7:725f5fb7e3a3 | 257 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 258 | |
mustwillza | 7:725f5fb7e3a3 | 259 | char cmd[128] = "GET http://"; |
mustwillza | 7:725f5fb7e3a3 | 260 | strcat(cmd,domain); |
mustwillza | 7:725f5fb7e3a3 | 261 | strcat(cmd,dir); |
mustwillza | 7:725f5fb7e3a3 | 262 | strcat(cmd,"?key=fra221a0636"); |
mustwillza | 7:725f5fb7e3a3 | 263 | strcat(cmd,"&depositor="); |
mustwillza | 7:725f5fb7e3a3 | 264 | strcat(cmd,depositor); |
mustwillza | 7:725f5fb7e3a3 | 265 | |
mustwillza | 7:725f5fb7e3a3 | 266 | //="GET http://%s%s%s",domain,dir,value; |
mustwillza | 7:725f5fb7e3a3 | 267 | char buffer[2] = ""; |
mustwillza | 7:725f5fb7e3a3 | 268 | strcat(cmd," HTTP/1.0\r\n\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 269 | sprintf(buffer , "%d",strlen(cmd) ); |
mustwillza | 7:725f5fb7e3a3 | 270 | |
mustwillza | 7:725f5fb7e3a3 | 271 | strcpy(snd,"AT+CIPSEND=0,"); |
mustwillza | 7:725f5fb7e3a3 | 272 | strcat(snd,buffer); |
mustwillza | 7:725f5fb7e3a3 | 273 | strcat(snd,"\r\n"); |
mustwillza | 7:725f5fb7e3a3 | 274 | pc.printf("%d %d",strlen(cmd) ,strlen(snd)); |
mustwillza | 7:725f5fb7e3a3 | 275 | pc.printf(snd); |
mustwillza | 7:725f5fb7e3a3 | 276 | pc.printf(cmd); |
mustwillza | 7:725f5fb7e3a3 | 277 | |
mustwillza | 7:725f5fb7e3a3 | 278 | |
mustwillza | 7:725f5fb7e3a3 | 279 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 280 | timeout=1; |
mustwillza | 7:725f5fb7e3a3 | 281 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 282 | pc.printf(buf); |
mustwillza | 8:e683edc8a530 | 283 | wait(1); |
mustwillza | 7:725f5fb7e3a3 | 284 | |
mustwillza | 7:725f5fb7e3a3 | 285 | pc.printf("Start point to url...\n"); |
mustwillza | 7:725f5fb7e3a3 | 286 | strcpy(snd,cmd); |
mustwillza | 7:725f5fb7e3a3 | 287 | SendCMD(); |
mustwillza | 8:e683edc8a530 | 288 | timeout=3; |
mustwillza | 7:725f5fb7e3a3 | 289 | getreply(); |
mustwillza | 7:725f5fb7e3a3 | 290 | pc.printf(buf); |
mustwillza | 7:725f5fb7e3a3 | 291 | } |