This is a simple mbed client example demonstrating, registration of a device with mbed Device Connector and reading and writing values as well as deregistering on different Network Interfaces including Ethernet, WiFi, 6LoWPAN ND and Thread respectively.

Fork of mbed-os-example-client by mbed-os-examples

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Fri Aug 05 04:30:15 2016 +0100
Parent:
12:7da135488950
Child:
14:09a1008b2d7a
Commit message:
Merge pull request #71 from geky/wifi-config-pins

Add configurable serial-pins to support USBTX/RX == D1/D0 devices

Commit copied from https://github.com/ARMmbed/mbed-os-example-client

Changed in this revision

README.md 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
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- a/README.md	Thu Aug 04 18:15:18 2016 +0100
+++ b/README.md	Fri Aug 05 04:30:15 2016 +0100
@@ -182,6 +182,22 @@
     }
 ```
 
+<span class="notes">**Note:** Some devices don't support the Grove Shield or use the primary UART for USB communication. On these devices, the `mbed_app.json` should be modified to use the serial pins connected to the ESP8266.</span>
+
+For example, the NUCLEO_F401RE requires a different serial connection:
+
+```json
+    "wifi-tx": {
+        "help": "TX pin for serial connection to external device",
+        "value": "PA_11"
+    },
+    "wifi-rx": {
+        "help": "RX pin for serial connection to external device",
+        "value": "PA_12"
+    }
+```
+
+
 ### IP address setup
 
 This example uses IPv4 to communicate with the [mbed Device Connector Server](https://api.connector.mbed.com) except for 6LoWPAN ND and Thread. The example program should automatically get an IPv4 address from the router when connected over Ethernet.
--- a/main.cpp	Thu Aug 04 18:15:18 2016 +0100
+++ b/main.cpp	Fri Aug 05 04:30:15 2016 +0100
@@ -33,7 +33,7 @@
 
 #if MBED_CONF_APP_NETWORK_INTERFACE == WIFI
 #include "ESP8266Interface.h"
-ESP8266Interface esp(D1, D0);
+ESP8266Interface esp(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
 #elif MBED_CONF_APP_NETWORK_INTERFACE == ETHERNET
 #include "EthernetInterface.h"
 EthernetInterface eth;
--- a/mbed_app.json	Thu Aug 04 18:15:18 2016 +0100
+++ b/mbed_app.json	Fri Aug 05 04:30:15 2016 +0100
@@ -11,6 +11,14 @@
         "wifi-password": {
             "help": "WiFi Password",
             "value": "\"Password\""
+        },
+        "wifi-tx": {
+            "help": "TX pin for serial connection to external device",
+            "value": "D1"
+        },
+        "wifi-rx": {
+            "help": "RX pin for serial connection to external device",
+            "value": "D0"
         }
     },
     "macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_mbed_client_config.h\""],
@@ -19,6 +27,14 @@
             "target.features_add": ["CLIENT", "COMMON_PAL"],
             "mbed-client.reconnection-count": 3,
             "mbed-client.reconnection-interval": 5
+        },
+        "NUCLEO_F401RE": {
+            "wifi-tx": "PA_11",
+            "wifi-rx": "PA_12"
+        },
+        "NUCLEO_F411RE": {
+            "wifi-tx": "PA_11",
+            "wifi-rx": "PA_12"
         }
     }
 }