Sample program for using Pubnub on AT&T IoT Starter Kit (which has the WNC modem)
Dependencies: Pubnub_mbed2_sync WNCInterface mbed-rtos mbed
Fork of WNCInterface_M2XMQTTdemo by
Diff: main.cpp
- Revision:
- 2:e355d362a2d8
- Parent:
- 1:ceb54785e67c
- Child:
- 3:84f5cf6f2521
diff -r ceb54785e67c -r e355d362a2d8 main.cpp --- a/main.cpp Tue Sep 27 19:54:39 2016 +0000 +++ b/main.cpp Fri Oct 07 01:15:05 2016 +0000 @@ -43,35 +43,35 @@ double hval = 101.0; pc.baud(115200); - printf(CRLF CRLF "M2X MQTT Test starting..." CRLF); + pc.printf(CRLF CRLF "M2X MQTT Test starting..." CRLF); eth.init(NULL,&pc); eth.connect(); - printf("IP Address: %s" CRLF, eth.getIPAddress()); + pc.printf("IP Address: %s" CRLF, eth.getIPAddress()); eth.doDebug(0); while (true) { tval += 0.1; - printf("\r\n\r\nSending readings #%d\r\n",cnt++); + pc.printf("\r\n\r\nSending readings #%d\r\n",cnt++); response = m2xClient.updateStreamValue(deviceId, tstreamName, tval); - printf("Sending temperature value: %lf, Response= %d" CRLF, tval, response); + pc.printf("Sending temperature value: %lf, Response= %d" CRLF, tval, response); hval -= 1.0; - printf("Sending humidity value: %lf", hval); + pc.printf("Sending humidity value: %lf", hval); response = m2xClient.updateStreamValue(deviceId, hstreamName, hval); - printf(", Response= %d" CRLF, response); + pc.printf(", Response= %d" CRLF, response); - printf("Calling postDeviceUpdates..."); + pc.printf("Calling postDeviceUpdates..."); response = m2xClient.postDeviceUpdates(deviceId, streamNum, streamNames, counts, ats, values); - printf(" Response = %d" CRLF, response); - printf("Calling updateLocation..."); + pc.printf(" Response = %d" CRLF, response); + pc.printf("Calling updateLocation..."); response = m2xClient.updateLocation(deviceId, name, latitude, longitude, elevation); - printf(" Response = %d" CRLF, response); + pc.printf(" Response = %d" CRLF, response); elevation++; delay(6000);