Pages: [1]   Go Down
Author Topic: xively.com  (Read 522 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,  I got xively.com library and started the basic upload sketch. I also registered in the website and got some numbers:
Product ID
Product Secret
Activation Code
Feed ID
Feed URL
API Endpoint

In the sketch, there is a variable " xivelyKey". Which number of above shall i insert for xivelyKey?
Do u know what I should get for "xivelyclient.put" in the serial monitor?
If everything goes right, can I see my data in Channel section of my profile in the website?
Tnx.
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have routines that look like this. The first 2 items you get from your xively account, the  other lines show how they're used. Return code = 200, if it goes ok.

Code:
#define API_KEY   "..............................."
#define FEED_ID   12345678       // Xively feed ID = unsigned long

// Create three datastreams for the feed
#define NUM_FEEDS   3
#define chLIGHT     0    // 1st channel.
#define chTEMP1     1
#define chTEMP2     2

// Define the strings for our datastream IDs
char* sensorID[NUM_FEEDS] = { "light", "temp1", "temp2" };

XivelyDatastream datastreams[NUM_FEEDS] = {
  XivelyDatastream( sensorID[0], strlen(sensorID[0]), DATASTREAM_FLOAT),
  XivelyDatastream( sensorID[1], strlen(sensorID[1]), DATASTREAM_FLOAT),
  XivelyDatastream( sensorID[2], strlen(sensorID[2]), DATASTREAM_FLOAT),
};

// wrap the 3 datastreams into one feed.
XivelyFeed feed( FEED_ID, datastreams, NUM_FEEDS);


// insert data into Xively datastream.
/***************************************/
void setData( int ndx, float value )
{
  datastreams[ndx].setFloat(value);  // ~~~

  Serial.print("Sensor value is: ");
  Serial.println( datastreams[ndx].getFloat() );
}

/*************************************************************/
void sendFeed()
{
  Serial.println("Uploading to Xively");
  int ret = xClient.put(feed, API_KEY);
  
  Serial.print("xively PUT return code: ");
  Serial.println(ret);
}

Go here to see your feed, or else login to your account.
https://xively.com/feeds/12345678  <-- your feed ID.

EDIT: see also this post about enabling your account for writing, etc,
http://forum.arduino.cc/index.php?topic=178800.msg1326595#msg1326595
« Last Edit: July 24, 2013, 03:30:56 pm by oric_dan » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yep!
I got 200 and it is working!
Thanks.
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone knows how to configure Xively feed to fixing MAX and MIN of the Graph?

Thanks
Logged

Pages: [1]   Go Up
Jump to: