Demo app to read data from FXOS8700Q accelerometer on FRDM-K64F and send values to AT&T M2X Data Service via MTS shield. For use with DevLab

Dependencies:   FXOS8700Q M2XStreamClient SocketModem jsonlite mbed

Fork of M2X_MTS_Accel by AT&T M2X Team

Files at this revision

API Documentation at this revision

Comitter:
jb8414
Date:
Sat Aug 29 17:41:25 2015 +0000
Parent:
4:913fe6d89ea4
Commit message:
update to new M2XStreamClient

Changed in this revision

M2XStreamClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/M2XStreamClient.lib	Fri Sep 05 02:07:07 2014 +0000
+++ b/M2XStreamClient.lib	Sat Aug 29 17:41:25 2015 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/teams/ATT-M2X-team/code/M2XStreamClient/#4d7109bae9cf
+https://mbed.org/teams/ATT-M2X-team/code/M2XStreamClient/#2610823f7f2e
--- a/main.cpp	Fri Sep 05 02:07:07 2014 +0000
+++ b/main.cpp	Sat Aug 29 17:41:25 2015 +0000
@@ -6,9 +6,9 @@
 
 using namespace mts;
 
-const char key[] = "<key>";       // Replace with your M2X user account master key
-const char feed[] = "<feed>";     // Replace with your blueprint feed ID
-const char stream[] = "<stream>"; // Replace with your stream name
+char deviceId[] = "<device id>"; // Device you want to push to
+char streamName[] = "<stream name>"; // Stream you want to push to
+char m2xKey[] = "<m2x api key>"; // Your M2X API Key or Master API Key
 
 // set to 1 for cellular shield board
 // set to 0 for wifi shield board
@@ -94,7 +94,7 @@
 
     // Initialize the M2X client
     Client client;
-    M2XStreamClient m2xClient(&client, key);
+    M2XStreamClient m2xClient(&client, m2xKey);
     int ret;
 
     // Add code below to read accelerometer data and post to M2X stream
@@ -125,9 +125,9 @@
         // If the maximum title is over 20 degrees, then send
         // data to stream
         if (maxTilt > 20) {
-            ret = m2xClient.post(feed, stream, maxTilt);
+            ret = m2xClient.updateStreamValue(deviceId, streamName, maxTilt);
             printf("send() returned %d\r\n", ret);
-            wait(0.5);
+            wait(1.0);
         }
     }
 }
\ No newline at end of file