Im using the wifi shield at the moment, using the arduino wifi pachube example added an extra sensor
Add two reading lines at the start of loop(), ie
int sensorReading = analogRead(A0);
int sensorReading2 = analogRead(A1);
Pass the 2nd reading into the 'sendData' method at the end of loop()
sendData(sensorReading, sensorReading2);
Then change the sendData method to accept two values and package those up for sending also
// this method makes a HTTP connection to the server:
void sendData(int thisData, int thisData2) {
// if there's a successful connection:
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP PUT request:
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
client.println("Host: api.cosm.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
client.println(USERAGENT);
client.print("Content-Length: ");
// calculate the length of the sensor reading in bytes:
// 8 bytes for "sensor1," + number of digits of the data:
// plus the same again and length of data 2
int thisLength = 8 + getLength(thisData) + 8 + getLength(thisData2);
client.println(thisLength);
// last pieces of the HTTP PUT request:
client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();
// here's the actual content of the PUT request:
client.print("sensor1,");
client.println(thisData);
// and the 2nd sensor
client.print("sensor2,");
client.println(thisData2);
}
else {
// if you couldn't make a connection:
Serial.println("connection failed");
Serial.println();
Serial.println("disconnecting.");
client.stop();
}
// note the time that the connection was made or attempted:
lastConnectionTime = millis();
}
this code i found on the cosm forum
this is the message I get
and i get no values on my feed
CSV Parser Error: CSV is invalid. Incorrect number of fields
disconnecting.
connecting...
HTTP/1.1 400 Bad Request
Date: Sat, 09 Mar 2013 14:00:22 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 60
Connection: close
X-Request-Id: 94849a7b1e96abaa62c7145ff139221428ceddcb