HoYa's MBED (Nucleo-F401RE)

Dependencies:   NetworkSocketAPI X_NUCLEO_IDW01M1v2 mbed

Files at this revision

API Documentation at this revision

Comitter:
HoYa
Date:
Thu Jul 20 07:50:49 2017 +0000
Parent:
0:63d30ec829b6
Child:
2:d7647babe160
Commit message:
DNS Testing

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jul 20 06:44:02 2017 +0000
+++ b/main.cpp	Thu Jul 20 07:50:49 2017 +0000
@@ -1,27 +1,34 @@
 #include "mbed.h"
 #include "SpwfInterface.h"
+#include "TCPSocket.h"
 
 Serial pc(USBTX, USBRX, 115200);
 DigitalOut led(LED1);
 
-SpwfSAInterface spwf(D8, D2, true);
+SpwfSAInterface spwf(D8, D2, false);
 
 int main() {
     pc.printf("\r\n");
     pc.printf("Start Application\r\n");
     
+    pc.printf("\r\n");
     pc.printf("Connecting to AP...\r\n");
     if (spwf.connect("hRPi3-AP", "rlawjdgh", NSAPI_SECURITY_WPA2)) {
+//    if (spwf.connect("RP_RND_A", "radio1106", NSAPI_SECURITY_WPA2)) {
         pc.printf("=> Success.\r\n");
     } else {
         pc.printf("=> Failed to connect.\r\n");
         return -1;
-    }
-    
+    }    
     const char* ip = spwf.get_ip_address();
     pc.printf("=> IP Address is: %s\r\n", (ip) ? ip : "No IP");
     const char* mac = spwf.get_mac_address();   
     pc.printf("=> MAC Address is: %s\r\n", (mac) ? mac : "No MAC");
+    
+    pc.printf("\r\n");
+    pc.printf("DNS Testing...\r\n");
+    SocketAddress addr(&spwf, "st.com");
+    pc.printf("<st.com> is resolved to: %s\r\n", addr.get_ip_address());
 
     while (1) {
         led = !led;