Paul: How to set up multiple data steams with Pachube

I have moved this post from the old forum:

Paul:

I have downloaded the NUClient Pachube, however, I made changes to the code because I am using an ardiuno ethernet shield. I have one graph working fine but cannot figure out how to add another feed. Has anyone put up their data on pachube and have sample code?

Here is the code:
/*
Nuelectronics ethernet shield client example - sending data to pachube
Created by Trystan Lea, April 31 2010
GNU General Public Licence: [openenergymonitor.org]
*/
#include <SPI.h>
#include <Ethernet.h>

//Set these to your feed ID and pachube api key
#define SHARE_FEED_ID // this is your Pachube feed ID that you want to share to
#define PACHUBE_API_KEY "" // fill in your API key

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00,0x3B, 0x8F};
byte ip[] = { 192,168,2,50 };
byte gateway[]={192,168,2,1};
byte subnet[] = {255,255,255,0};
byte server[] = { 173, 203, 98, 29 }; //Pachube.com

//Some variables to send
double valA = 10.23;
double valB = 22.34;

int content_length;

Client client(server, 80);

void setup() {
Ethernet.begin(mac, ip,gateway,subnet);
//analogReference(EXTERNAL);
Serial.begin(9600);

delay(1000);
Serial.println("Connecting...";

}

void loop()
{

//Do things that need to be done even when
//the ethernet shield is connecting etc here.

//If the client has finished sending.

//Increment values so that we can see something happening!
valA += 1.2;
valB += 0.2;

//Do things that only need to be done when
//the client has done sending.
delay(10000);
//Tell the client that it is not done and it needs to start sending again.

Serial.println("start";

//client.process opens and closes the client connection
//It returns a one when the connection is at the data
//sending stage.
//client process will also check for pings
if(client.connect())
{
Serial.println("connecting";
//This seems to work set as 1?
content_length = 1;

// 1) Send feed id, pachube api key
client.print("PUT /api/";
client.print(SHARE_FEED_ID);
client.print(".csv HTTP/1.1\nHost: pachube.com\nX-PachubeApiKey: ";
client.print(PACHUBE_API_KEY);
client.print("\nUser-Agent: ecotinker";
client.print("\nContent-Type: text/csv\nContent-Length: ";
client.print(content_length);
client.print("\nConnection: close\n\n";

// 2) Send the data - comma seperated
client.print(valA);
client.print(",";
client.print(val;
client.println();
//sends all of the above
client.stop();
Serial.println("data sent";
}
else {
Serial.println("Failed to connect to client";
}

}

Thanks,

Paul.

--------------------

Reply:

Figured out problem. The content length was the main problem and the client.println();

However, I am trying to find a way to find the length of double for content length. I see ways to do it for ints and strings but I cannot find any examples to find length for doubles.

Thanks.