Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 37:3a31525e2971
- Parent:
- 35:052c1ba06ce7
- Child:
- 44:63be19b7a3db
--- a/main.cpp Wed Sep 27 11:15:04 2017 +0100 +++ b/main.cpp Fri Sep 29 10:15:04 2017 +0100 @@ -59,7 +59,7 @@ } } -void scan_demo(WiFiInterface *wifi) +int scan_demo(WiFiInterface *wifi) { WiFiAccessPoint *ap; @@ -81,6 +81,7 @@ printf("%d networks available.\n", count); delete[] ap; + return count; } void http_demo(NetworkInterface *net) @@ -132,11 +133,17 @@ int main() { + int count = 0; + printf("WiFi example\n\n"); - scan_demo(&wifi); + count = scan_demo(&wifi); + if (count == 0) { + printf("No WIFI APNs found - can't continue further.\n"); + return -1; + } - printf("\nConnecting...\n"); + 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); if (ret != 0) { printf("\nConnection error\n");