Simple Mbed Cloud client application using features of K64 including Wi-Fi and SD Card
Fork of mbed-cloud-connect-example-ethernet by
Diff: main.cpp
- Revision:
- 11:4cd5fd7c7821
- Parent:
- 8:ace9e5de6491
diff -r ceea650f6323 -r 4cd5fd7c7821 main.cpp --- 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;