Example for connecting to Cayenne using an X-NUCLEO-IDW01M1 WiFi and IKS01A2 expansion board.
Dependencies: Cayenne-MQTT-mbed mbed X_NUCLEO_IDW01M1v2 NetworkSocketAPI
Revision 7:78cefe0937ab, committed 2016-11-11
- Comitter:
- jburhenn
- Date:
- Fri Nov 11 18:29:29 2016 +0000
- Parent:
- 6:8343c40d2a1a
- Child:
- 8:d54aac9e5c12
- Commit message:
- Added comment to explain how to change the interval for publishing data.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 09 17:21:08 2016 +0000
+++ b/main.cpp Fri Nov 11 18:29:29 2016 +0000
@@ -133,6 +133,7 @@
*/
void loop(void)
{
+ // Start the countdown timer for publishing data every 5 seconds. Change the timeout parameter to publish at a different interval.
MQTTTimer timer(5000);
while (true) {
@@ -162,6 +163,7 @@
if ((error = mqttClient.publishData(DATA_TOPIC, 3, TYPE_BAROMETRIC_PRESSURE, UNIT_HECTOPASCAL, 800)) != CAYENNE_SUCCESS) {
printf("Publish barometric pressure failed, error: %d\n", error);
}
+ // Restart the countdown timer for publishing data every 5 seconds. Change the timeout parameter to publish at a different interval.
timer.countdown_ms(5000);
}
}