Example for sending TMP36 sensor data to Cayenne using an X-NUCLEO-IDW01M1 WiFi expansion board.

Dependencies:   Cayenne-MQTT-mbed NetworkSocketAPI TMP36 X_NUCLEO_IDW01M1v2 mbed

Files at this revision

API Documentation at this revision

Comitter:
jburhenn
Date:
Fri Nov 11 18:31:11 2016 +0000
Parent:
4:c2bff5a58129
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
diff -r c2bff5a58129 -r 294a8b1bca28 main.cpp
--- 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);
         }
     }