The ARM mbed MQTT client library is used to send/receive data to/from AT&T's M2X service (https://m2x.att.com/) using the AT&T Cellular IoT Starter Kit which is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).

Dependencies:   M2XMQTTClient WNCInterface mbed-rtos mbed minimal-json minimal-mqtt-JMF

Revision:
5:f9dc2e9e53a8
Parent:
4:c9290723dce9
Child:
6:853f6aac9a9d
--- a/main.cpp	Fri Oct 07 13:26:18 2016 +0000
+++ b/main.cpp	Fri Oct 07 13:50:48 2016 +0000
@@ -3,6 +3,7 @@
 
 #define DEBUG
 #define MBED_PLATFORM
+#define LOOP_DELAY_MS  3000
 
 #include "minimal-mqtt.h"
 #include "minimal-json.h"
@@ -48,14 +49,16 @@
   pc.printf("init() returned 0x%04X" CRLF, eth.init(NULL,&pc));
   eth.connect();
   pc.printf("IP Address: %s" CRLF, eth.getIPAddress());
-  eth.doDebug(3);
+  eth.doDebug(0);
   
   while (true) {
     tval += 0.1;
+    if( tval > 100.0 ) tval = 0.9;
     pc.printf("\r\n\r\nSending readings #%d\r\n",cnt++);
     response = m2xClient.updateStreamValue(deviceId, tstreamName, tval);
     pc.printf("Sending temperature value: %lf, Response= %d" CRLF, tval, response);
 
+    if( hval < 2.0 ) hval = 101.0;
     hval -= 1.0;
     pc.printf("Sending humidity value: %lf", hval);
     response = m2xClient.updateStreamValue(deviceId, hstreamName, hval);
@@ -74,7 +77,7 @@
     pc.printf(" Response =  %d" CRLF, response);
     elevation++;
     
-    delay(6000);
+    delay(LOOP_DELAY_MS);
   }
 }