for debug
Dependencies: HTTPClient PowerControl SNICInterface mbed-rtos mbed-src
Fork of HTTPClient_WiFi_HelloWorld by
Diff: main.cpp
- Revision:
- 10:87bc3840d0a5
- Parent:
- 8:0c400a5a28db
diff -r c1d57368ac9e -r 87bc3840d0a5 main.cpp --- a/main.cpp Tue May 12 04:59:24 2015 +0000 +++ b/main.cpp Sat Aug 15 04:02:17 2015 +0000 @@ -6,9 +6,9 @@ #include "PowerControl/EthernetPowerControl.h" #endif -#define DEMO_AP_SSID "toyowata-nad11" +#define DEMO_AP_SSID "Eric 5S" #define DEMO_AP_SECURITY_TYPE e_SEC_WPA2_AES -#define DEMO_AP_SECUTIRY_KEY "mbed.org" +#define DEMO_AP_SECUTIRY_KEY "liaoduck" #if defined(TARGET_LPC1768) C_SNIC_WifiInterface wifi( p9, p10, NC, NC, p30 ); @@ -25,11 +25,13 @@ int main() { + int ret = -1; #if defined(TARGET_LPC1768) PHY_PowerDown(); #endif pc.printf("WiFi init...\n"); + wifi.init(); wait(0.5); @@ -40,17 +42,21 @@ wait(0.3); // Connect AP - wifi.connect( DEMO_AP_SSID - , strlen(DEMO_AP_SSID) - , DEMO_AP_SECURITY_TYPE - , DEMO_AP_SECUTIRY_KEY - , strlen(DEMO_AP_SECUTIRY_KEY) ); - wait(0.5); + while(ret != 0) { + pc.printf("WiFi connectng...\n"); + ret = wifi.connect( DEMO_AP_SSID + , strlen(DEMO_AP_SSID) + , DEMO_AP_SECURITY_TYPE + , DEMO_AP_SECUTIRY_KEY + , strlen(DEMO_AP_SECUTIRY_KEY) ); + wait(1); + //pc.printf("ret is %d\n", ret); + }; wifi.setIPConfig( true ); //Use DHCP wait(0.5); pc.printf("IP Address is %s\n", wifi.getIPAddress()); - int ret = 0; + #if 0 // disabled this test, since the library doesn't support HTTPS connection //GET data