Federico Ferrari / Mbed 2 deprecated BMS_OX_FMF

Dependencies:   mbed

Revision:
4:dc0c58eedabb
Parent:
3:2360864c12e2
Child:
5:dad47e5b9586
--- a/main.cpp	Tue Nov 29 17:42:52 2016 +0000
+++ b/main.cpp	Tue Nov 29 18:18:13 2016 +0000
@@ -73,14 +73,23 @@
     // use AnalogIn() unfortunately...
     ConfigureADC();
     
-    // Connect to the wifi network. It will basically get stuck here until it
-    // connects to the network.
-    SetupNetwork(5000);
+    // Check for the wifi module
+    WifiPresent.mode(PullDown);
+    if(WifiPresent == 1){
+        IotStatus.SetFlag(SS_WIFIPRESENT);
+    }
+    
+    if(IotStatus.CheckFlag(SS_WIFIPRESENT)){
         
-    // Configure the baud rate of the wifi shield:
-    // This will make our wireless transmissions much faster.
-    ws.setBaud(115200);
-    wait(0.5f);
+        // Connect to the wifi network. It will basically get stuck here until it
+        // connects to the network.
+        SetupNetwork(5000);
+            
+        // Configure the baud rate of the wifi shield:
+        // This will make our wireless transmissions much faster.
+        ws.setBaud(115200);
+        wait(0.5f);
+    }
     
     // Configure the PWM module:
     ConfigurePWM(Duty_us, PwmPeriod_us);