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: Cayenne-MQTT-mbed mbed TMP36 X_NUCLEO_IDW01M1v2 NetworkSocketAPI
Diff: main.cpp
- Revision:
- 5:294a8b1bca28
- Parent:
- 2:d7c27e622707
- Child:
- 6:e23a088bd573
--- a/main.cpp Wed Nov 09 17:21:56 2016 +0000
+++ b/main.cpp Fri Nov 11 18:31:11 2016 +0000
@@ -134,6 +134,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);
TMP36 tmpSensor(A5);
@@ -158,6 +159,7 @@
if ((error = mqttClient.publishData(DATA_TOPIC, 5, TYPE_TEMPERATURE, UNIT_CELSIUS, tmpSensor.read())) != CAYENNE_SUCCESS) {
printf("Publish temperature 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);
}
}