Simple Mbed Cloud client application for NuMaker-PFM-M487 and NuMaker-PFM-NUC472 over Ethernet.
This application contains the example codes to:
1) Connect PFM-M487/PFM-NUC472 boards to Pelion
2) Enable Firmware update
For storage, PFM-M487/PFM-NUC472 support both SPI interface SD and built-in SD bus SD.
For connectivity, PFM-M487/PFM-NUC472 support Ethernet (on-board) by default.
This example supports Ethernet and built-in SD by default.
Diff: main.cpp
- Revision:
- 3:9e8abf07add2
- Parent:
- 0:83caa8fa1d2c
- Child:
- 7:6aee86899520
--- a/main.cpp Mon Jul 16 10:40:23 2018 +0100 +++ b/main.cpp Tue Jul 17 08:47:39 2018 +0100 @@ -23,9 +23,6 @@ //#define SDBLOCK_SPI_MODE -#define ETHERNET 1 -#define WIFI_ESP8266 2 - // An event queue is a very useful structure to debounce information between contexts (e.g. ISR and normal threads) // This is great because things such as network operations are illegal in ISR, so updating a resource in a button's fall() function is not allowed EventQueue eventQueue; @@ -43,13 +40,8 @@ FATFileSystem fs("sd", &bd); -#if MBED_CONF_APP_NETWORK_INTERFACE == WIFI_ESP8266 -#include "ESP8266Interface.h" -ESP8266Interface esp(D1, D0); -#elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET #include "EthernetInterface.h" EthernetInterface eth; -#endif // Declaring pointers for access to Mbed Cloud Client resources outside of main() @@ -129,16 +121,9 @@ printf("Starting Simple Mbed Cloud Client example\n"); printf("Connecting to the network ...\n"); -#if MBED_CONF_APP_NETWORK_INTERFACE == WIFI_ESP8266 - printf("\n\rUsing WiFi \r\n"); - printf("\n\rConnecting to WiFi..\r\n"); - status = esp.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2); - netobj = &esp; -#elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET printf("Using Ethernet\r\n"); status = eth.connect(); netobj = ð -#endif // Connect to the internet (DHCP is expected to be on) //EthernetInterface net;