Simple Mbed Cloud client application using features of K64 including Wi-Fi and SD Card

Fork of mbed-cloud-connect-example-ethernet by NXP

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Mon May 21 09:49:53 2018 +0000
Parent:
10:ceea650f6323
Commit message:
Changed to Wi-Fi connectivity (ESP8266)

Changed in this revision

esp8266-driver.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/esp8266-driver.lib	Mon May 21 09:49:53 2018 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/esp8266-driver/#0418c617714566dd948051626a72bd5f0ce5b415
--- a/main.cpp	Wed Feb 21 13:32:10 2018 +0000
+++ b/main.cpp	Mon May 21 09:49:53 2018 +0000
@@ -24,7 +24,10 @@
 #include "key-config-manager/key_config_manager.h"
 #include "SDBlockDevice.h"
 #include "FATFileSystem.h"
-#include "EthernetInterface.h"
+#include "ESP8266Interface.h"
+
+#define WIFI_SSID "SSID"
+#define WIFI_PSWD "PASSWORD"
 
 /* The following app uses Mbed Cloud with SD Card storage, button, & led */
 
@@ -33,6 +36,8 @@
 /* K64 & K66                 */ 
 InterruptIn sw2(SW2);
 DigitalOut led2(LED2);
+ESP8266Interface net(D1, D0);
+
 /*                           */
 
 // Placeholder for storage
@@ -106,9 +111,6 @@
     // Misc OS setup
     srand(time(NULL));
 
-    // Placeholder for network
-    EthernetInterface net;
-
     printf("Start Simple Mbed Cloud Client\n");
 
     // Initialize SD card
@@ -131,9 +133,10 @@
         }
     }
 
-    printf("Connecting to the network using Ethernet...\n");
+    printf("Connecting to the network using Wi-Fi...\n");
 
-    status = net.connect();
+    status = net.connect(WIFI_SSID, WIFI_PSWD, NSAPI_SECURITY_WPA_WPA2);
+    
     if (status) {
         printf("Connection to Network Failed %d!\n", status);
         return -1;