Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C12832_lcd EthernetInterface LM75B MMA7660 mbed-libxively-6eca970 mbed-rtos mbed
Fork of Application-xively-jumpstart-demo by
Revision 7:382c67265a5d, committed 2014-05-20
- Comitter:
- neelmani
- Date:
- Tue May 20 04:22:51 2014 +0000
- Parent:
- 6:9af362ececc4
- Commit message:
- led get
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 Tue May 20 04:22:51 2014 +0000
@@ -57,8 +57,10 @@
// 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 332668647 // set Xively Feed ID (numerical, no quoutes
+#define XI_FEED_ID 1075535002
+//#define XI_API_KEY "ZmCG3GmfnJzvt1LZnLdHfS9D5vlfNrXQSxKD1jpzqsAsp3bh" // set Xively API key (double-quoted string)
+#define XI_API_KEY "lS4FGex4YTyjAOFLoXAUrChwM8vAbux0SqSblk8KIdQclYp8"
#include "C12832_lcd.h"
@@ -66,6 +68,7 @@
MMA7660 axl(p28, p27);
LM75B tmp(p28, p27);
+AnalogIn pot1(p19);
extern "C" {
@@ -127,7 +130,7 @@
memset( &feed, NULL, sizeof( xi_feed_t ) );
feed.feed_id = XI_FEED_ID;
- feed.datastream_count = 3;
+ feed.datastream_count = 5;
feed.datastreams[0].datapoint_count = 1;
xi_datastream_t* orientation_datastream = &feed.datastreams[0];
@@ -144,6 +147,16 @@
strcpy( temperature_datastream->datastream_id, "temperature" );
xi_datapoint_t* current_temperature = &temperature_datastream->datapoints[0];
+ feed.datastreams[3].datapoint_count = 1;
+ xi_datastream_t* pot1_datastream = &feed.datastreams[3];
+ strcpy( pot1_datastream->datastream_id, "pot1" );
+ xi_datapoint_t* current_pot1 = &pot1_datastream->datapoints[0];
+
+ feed.datastreams[4].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 );
@@ -156,7 +169,7 @@
mbed_printf("feed:%d datastreams:[%s,%s]\n", feed.feed_id,
orientation_datastream->datastream_id,
- side_rotation_datastream->datastream_id);
+ side_rotation_datastream->datastream_id,led_datastream->datastream_id);
while(1) {
@@ -199,6 +212,34 @@
}
xi_set_value_f32( current_temperature, tmp.read() );
+
+ xi_set_value_f32( current_pot1, pot1.read() );
+
+ // read remote value
+ xi_datastream_get( xi_context, feed.feed_id
+ , led_datastream->datastream_id
+ , led_datastream->datapoints);
+
+ current_led = &led_datastream->datapoints[0];
+
+ int led_value = current_led->value.i32_value;
+
+ mbed_printf("%d",led_value);
+
+ wait(30);
+
+ //led_datastream->datapoints[0]
+
+ //xi_get_value_f32( current_led);
+
+ //const xi_response_t* response = xi_feed_get(xi_context,&feed);
+
+ //char a = (char)response.http.http_content[0];
+
+ //mbed_printf("%c",a);
+
+
+ //mbed_printf( "%f \n",(float)xi_feed_get( current_led) );
mbed_printf( "update...\n" );
xi_feed_update(xi_context, &feed);
