11/*
2- Cosm sensor client with Strings
2+ Pachube sensor client with Strings
33
4- This sketch connects an analog sensor to Cosm (http://www.cosm .com)
4+ This sketch connects an analog sensor to Pachube (http://www.pachube .com)
55 using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
66 the Adafruit Ethernet shield, either one will work, as long as it's got
77 a Wiznet Ethernet module on board.
88
9- This example has been updated to use version 2.0 of the Cosm .com API.
9+ This example has been updated to use version 2.0 of the pachube .com API.
1010 To make it work, create a feed with two datastreams, and give them the IDs
1111 sensor1 and sensor2. Or change the code below to match your feed.
1212
2020 created 15 March 2010
2121 modified 9 Apr 2012
2222 by Tom Igoe with input from Usman Haque and Joe Saavedra
23+ modified 8 September 2012
24+ by Scott Fitzgerald
2325
24- http://arduino.cc/en/Tutorial/CosmClientString
26+ http://arduino.cc/en/Tutorial/PachubeClientString
2527 This code is in the public domain.
2628
2729 */
3032#include < Ethernet.h>
3133
3234
33- /#define APIKEY " YOUR API KEY GOES HERE" // replace your Cosm api key here
35+ /#define APIKEY " YOUR API KEY GOES HERE" // replace your Pachube api key here
3436#define FEEDID 00000 // replace your feed ID
3537#define USERAGENT " My Project" // user agent is the project name
3638
@@ -49,12 +51,12 @@ EthernetClient client;
4951
5052// if you don't want to use DNS (and reduce your sketch size)
5153// use the numeric IP instead of the name for the server:
52- IPAddress server (216 ,52 ,233 ,121 ); // numeric IP for api.cosm .com
53- // char server[] = "api.cosm .com"; // name address for Cosm API
54+ IPAddress server (216 ,52 ,233 ,121 ); // numeric IP for api.pachube .com
55+ // char server[] = "api.pachube .com"; // name address for pachube API
5456
5557unsigned long lastConnectionTime = 0 ; // last time you connected to the server, in milliseconds
5658boolean lastConnected = false ; // state of the connection last time through the main loop
57- const unsigned long postingInterval = 10 *1000 ; // delay between updates to Cosm .com
59+ const unsigned long postingInterval = 10 *1000 ; // delay between updates to pachube .com
5860
5961void setup () {
6062 // Open serial communications and wait for port to open:
@@ -83,7 +85,7 @@ void loop() {
8385 dataString += sensorReading;
8486
8587 // you can append multiple readings to this String if your
86- // Cosm feed is set up to handle multiple values:
88+ // pachube feed is set up to handle multiple values:
8789 int otherSensorReading = analogRead (A1);
8890 dataString += " \n sensor2," ;
8991 dataString += otherSensorReading;
@@ -123,8 +125,8 @@ void sendData(String thisData) {
123125 client.print (" PUT /v2/feeds/" );
124126 client.print (FEEDID);
125127 client.println (" .csv HTTP/1.1" );
126- client.println (" Host: api.cosm .com" );
127- client.print (" X-CosmApiKey : " );
128+ client.println (" Host: api.pachube .com" );
129+ client.print (" X-pachubeApiKey : " );
128130 client.println (APIKEY);
129131 client.print (" User-Agent: " );
130132 client.println (USERAGENT);
0 commit comments