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: simple-mbed-cloud-client LM75B MMA7660
Fork of mbed-cloud-connect-example-wifi by
Diff: main.cpp
- Revision:
- 11:4cd5fd7c7821
- Parent:
- 8:ace9e5de6491
- Child:
- 13:428ae6d8349a
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;
