"led" numerical variable is pushed out from Xively. It is received and printed by mbed. You can edit the number in Xively.

Dependencies:   C12832_lcd EthernetInterface LM75B MMA7660 mbed-libxively-6eca970 mbed-rtos mbed

Fork of Application-xively-jumpstart-demo by avnish aggarwal

Files at this revision

API Documentation at this revision

Comitter:
thomas_sullivan
Date:
Sat May 31 23:37:01 2014 +0000
Parent:
6:9af362ececc4
Commit message:
An updated version of Avnish's Xively jumpstart. The fourth numerical variable "led" is pushed out from Xively and printed by mbed.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 24 22:40:17 2013 +0000
+++ b/main.cpp	Sat May 31 23:37:01 2014 +0000
@@ -57,8 +57,8 @@
 
 // 332668647
 // ZmCG3GmfnJzvt1LZnLdHfS9D5vlfNrXQSxKD1jpzqsAsp3bh
-#define XI_FEED_ID 332668647 // set Xively Feed ID (numerical, no quoutes
-#define XI_API_KEY "ZmCG3GmfnJzvt1LZnLdHfS9D5vlfNrXQSxKD1jpzqsAsp3bh" // set Xively API key (double-quoted string) 
+#define XI_FEED_ID 442300006 // set Xively Feed ID (numerical, no quoutes
+#define XI_API_KEY "FvameuMiutLFm5O135FCYEQn6okK8gijbsjPXTcSYARgkCYv" // set Xively API key (double-quoted string) 
 
 #include "C12832_lcd.h"
 
@@ -127,7 +127,7 @@
     memset( &feed, NULL, sizeof( xi_feed_t ) );
     
     feed.feed_id = XI_FEED_ID;
-    feed.datastream_count = 3;
+    feed.datastream_count = 4;
     
     feed.datastreams[0].datapoint_count = 1;
     xi_datastream_t* orientation_datastream = &feed.datastreams[0];
@@ -144,6 +144,11 @@
     strcpy( temperature_datastream->datastream_id, "temperature" );
     xi_datapoint_t* current_temperature = &temperature_datastream->datapoints[0];
     
+    feed.datastreams[3].datapoint_count = 1;
+    xi_datastream_t* led_datastream = &feed.datastreams[3];
+    strcpy( led_datastream->datastream_id, "led" );
+    xi_datapoint_t* current_led = &led_datastream->datapoints[0];
+    
     // create the cosm library context
     xi_context_t* xi_context
         = xi_create_context( XI_HTTP, XI_API_KEY, feed.feed_id );
@@ -202,8 +207,14 @@
         
       mbed_printf( "update...\n" );
       xi_feed_update(xi_context, &feed);
-      mbed_printf( "done...\n" );
+      //xi_response_t myInData;
+      //myInData = xi_feed_get(xi_context, &feed);
+      xi_datastream_get(xi_context, feed.feed_id, led_datastream->datastream_id, led_datastream->datapoints);
+      mbed_printf( "%d...\n",led_datastream->datapoints[0]);
       
-      wait( 15.0 );
+      extern const xi_response_t* xi_datastream_get(xi_context_t* xi, int32_t feed_id
+        , const char * datastream_id, xi_datapoint_t* dp );
+      
+      wait( 5.0 );
     }
 }
\ No newline at end of file