Simple Mbed Cloud client application using features of K64F including Wi-Fi and SD Card
Fork of mbed-cloud-connect-example-ethernet by
Configuration
- Put ESP-WROOM-02 shield
- Put Mbed Application Shield
- Edit the text in the main.cpp
#define WIFI_SSID "SSID" #define WIFI_PSWD "PASSWORD"
- Download and replace your developer certificate from Mbed Cloud portal from the menu [Mbed Cloud] - [Certificate]
Diff: main.cpp
- Revision:
- 4:a107dae867fb
- Parent:
- 2:6ed27f413b30
- Child:
- 5:c18fab181ede
--- a/main.cpp Wed Feb 14 13:22:50 2018 +0000 +++ b/main.cpp Wed Feb 14 15:09:00 2018 +0000 @@ -26,7 +26,8 @@ #include "FATFileSystem.h" #include "EthernetInterface.h" -InterruptIn button(BUTTON1); +// Placeholder to hardware that trigger events (timer, button, etc) +Ticker timer; // Pointers to the resources that will be created in main_application(). static MbedCloudClientResource* pattern_ptr; @@ -109,8 +110,8 @@ printf("IP address %s\n", ip_addr); } - // Placeholder for GET requests. Initialize button interrupt. - button.fall(&button_press); + // Placeholder for callback to update local resource when GET comes. + timer.attach(&button_press, 5.0); SimpleMbedCloudClient mbedClient(&net); // Save pointer to mbedClient so that other functions can access it. @@ -149,7 +150,7 @@ if (button_pressed) { button_pressed = false; - printf("Button clicked %d times\r\n", ++button_count); + printf("Simulated button clicked %d times\r\n", ++button_count); button->set_value(button_count); } }