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:
50:31005695f3a3
Parent:
49:3df367a86ec7
--- a/main.cpp	Mon Dec 18 23:46:25 2017 +0000
+++ b/main.cpp	Tue Dec 19 17:00:27 2017 +0900
@@ -123,7 +123,7 @@
     }
 
     // Recieve a simple http response and print out the response line
-    char rbuffer[64];
+    char rbuffer[512];
     response = socket.recv(rbuffer, sizeof rbuffer);
     if (response < 0) {
         printf("Error receiving data: %d\n", response);
@@ -141,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);