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.
Dependencies: NNN50_WIFI_API
This is a must try example for basic WIFI functions using DELTA DFCM-NNN50 platform. In order to test with this example, user first need to open UDP Server port (use 1030 in this example) on a PC or mobile with Socket test tool (download UDP Test Tool' for PC, and Socket X for iOS or anymore socket test tool program available) When this example is running, the module will connect to a pre-defined AP router and run as UDP Client. For more information on the usage of regular TCP and UDP Sockets, the mbed handbook can be found here
Diff: main.cpp
- Revision:
- 3:9bd3e863e15b
- Parent:
- 2:92946804ed6f
- Child:
- 4:11b81280c65b
--- a/main.cpp Mon Dec 19 03:56:13 2016 +0000 +++ b/main.cpp Sun Apr 02 10:16:20 2017 +0000 @@ -32,22 +32,24 @@ WIFIDevice wifi; uart.baud(9600); - + eth.init(); - uart.printf("MAC: %s\n", eth.getMACAddress()); wifi.apScan(scanCallback); wifi.setNetwork(M2M_WIFI_SEC_WPA_PSK, "TP-LINK_2.4G_TTWU", "0972753720"); - eth.connect(); - printf("IP: %s\n", eth.getIPAddress()); - printf("Gateway: %s\n", eth.getGateway()); - printf("NetworkMask: %s\n", eth.getNetworkMask()); + + eth.connect(); if(wifi.is_AP_connected()) uart.printf("Connect Success! \n"); else - uart.printf("Connect Fail! \n"); + uart.printf("Connect Fail! \n"); + + uart.printf("MAC: %s\n", eth.getMACAddress()); + uart.printf("IP: %s\n", eth.getIPAddress()); + uart.printf("Gateway: %s\n", eth.getGateway()); + uart.printf("NetworkMask: %s\n", eth.getNetworkMask()); UDPSocket sock; sock.init();