Mara Reid / Mbed 2 deprecated MTS_Wifi_Connect_Example_ATT

Dependencies:   SocketModem mbed

Fork of MTS_Wifi_Connect_Example by Multi-Hackers

Files at this revision

API Documentation at this revision

Comitter:
mfiore
Date:
Sat Jan 04 21:37:02 2014 +0000
Parent:
7:25269711fb2c
Child:
9:b8765986190f
Commit message:
put Wifi::Connect call in loop for robustness

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Jan 04 21:12:06 2014 +0000
+++ b/main.cpp	Sat Jan 04 21:37:02 2014 +0000
@@ -33,7 +33,11 @@
     //Setup and check connection
     printf("Set Network: %s\n\r", getCodeNames(wifi->setNetwork(ssid, securityType, securityKey)).c_str());
     printf("Set DHCP: %s\n\r", getCodeNames(wifi->setDeviceIP("DHCP")).c_str());
-    printf("Connect: %s\n\r", wifi->connect() ? "Success" : "Failure");
+    while (! wifi->connect()) {
+        printf("Connect: Failure\r\n");
+        wait(1);
+    }
+    printf("Connect: Success\r\n");
     printf("Is Connected: %s\n\r", wifi->isConnected() ? "True" : "False");
     
     //Ping