A quick example of a simple WiFi application using the WiFi and network-socket APIs that is provided as a part of mbed-os.

Dependencies:   WizFi310Interface_Draft

Fork of mbed-os-example-mbed5-wifi by mbed-os-examples

Revision:
49:3df367a86ec7
Parent:
44:63be19b7a3db
Child:
50:31005695f3a3
--- a/main.cpp	Mon Dec 04 14:00:03 2017 +0000
+++ b/main.cpp	Mon Dec 18 23:46:25 2017 +0000
@@ -19,6 +19,7 @@
 
 #define WIFI_ESP8266    1
 #define WIFI_IDW0XX1    2
+#define WIFI_WIZFI310   3
 
 #if TARGET_UBLOX_EVK_ODIN_W2
 #include "OdinWiFiInterface.h"
@@ -36,6 +37,9 @@
 #elif MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
 #include "SpwfSAInterface.h"
 SpwfSAInterface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
+#elif MBED_CONF_APP_WIFI_SHIELD == WIFI_WIZFI310
+#include "WizFi310Interface.h"
+WizFi310Interface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
 #endif // MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
 
 #endif
@@ -137,11 +141,11 @@
 
     printf("WiFi example\n\n");
 
-    count = scan_demo(&wifi);
-    if (count == 0) {
-        printf("No WIFI APNs found - can't continue further.\n");
-        return -1;
-    }
+    //count = scan_demo(&wifi);
+    //if (count == 0) {
+    //    printf("No WIFI APNs found - can't continue further.\n");
+    //    return -1;
+    //}
 
     printf("\nConnecting to %s...\n", MBED_CONF_APP_WIFI_SSID);
     int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);