wifi setup APmode
Dependencies: mbed
Diff: main.cpp
- Revision:
- 7:8055eb42a0f0
- Parent:
- 6:c3c9277c64ba
--- a/main.cpp Mon Aug 24 02:36:06 2020 +0000 +++ b/main.cpp Wed Sep 09 04:44:48 2020 +0000 @@ -7,7 +7,7 @@ DigitalOut reset(p26); Timer t; -int count,ended,timeout; +int ount,ended,timeout; char buf[1024]; char snd[255]; @@ -21,7 +21,7 @@ //char ssid[32] = "802ZTa-003243"; //char pwd [32] = "0129875a"; -char ssid[32] = "mbed01"; +char ssid[32] = "mbed06"; char pwd [32] = "0123456789a"; void SendCMD(),getreply(),ESPconfig(),ESPsetbaudrate(); @@ -164,6 +164,8 @@ strcat(snd, "5"); //<chl>: channel ID. strcat(snd, ","); strcat(snd, "4"); //<ecn>: encryption method; WEP is notsupported.(0:OPEN, 2:WPA_PSK, 3:WPA2_PSK, 4:WPA_WPA2_PSK) + strcat(snd, ","); + strcat(snd, "1"); // <max conn>: max connect. strcat(snd, "\r\n"); // "を入力し改行 //「AT+CWJAP="ssid","pwd",5,3」 SendCMD(); timeout=10; @@ -205,11 +207,11 @@ memset(buf, '\0', sizeof(buf)); t.start(); ended=0; - count=0; + ount=0; while(!ended) { if(esp.readable()) { - buf[count] = esp.getc(); - count++; + buf[ount] = esp.getc(); + ount++; } if(t.read() > timeout) { ended = 1;