11/*
2- Pachube sensor client with Strings
2+ Cosm sensor client with Strings
33
4- This sketch connects an analog sensor to Pachube (http://www.pachube .com)
4+ This sketch connects an analog sensor to Cosm (http://www.cosm .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 Pachube .com API.
9+ This example has been updated to use version 2.0 of the Cosm .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
2121 updated 16 Mar 2012
2222 by Tom Igoe with input from Usman Haque and Joe Saavedra
2323
24- http://arduino.cc/en/Tutorial/PachubeClientString
24+ http://arduino.cc/en/Tutorial/CosmClientString
2525 This code is in the public domain.
2626
2727 */
3030#include < Ethernet.h>
3131
3232
33- #define APIKEY " YOUR API KEY GOES HERE" // replace your pachube api key here
33+ / #define APIKEY " YOUR API KEY GOES HERE" // replace your Cosm api key here
3434#define FEEDID 00000 // replace your feed ID
3535#define USERAGENT " My Project" // user agent is the project name
3636
37+
3738// assign a MAC address for the ethernet controller.
3839// fill in your address here:
3940 byte mac[] = {
4041 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED };
42+
4143// fill in an available IP address on your network here,
4244// for manual configuration:
4345IPAddress ip (10 ,0 ,1 ,20 );
@@ -47,12 +49,12 @@ EthernetClient client;
4749
4850// if you don't want to use DNS (and reduce your sketch size)
4951// use the numeric IP instead of the name for the server:
50- // IPAddress server(216,52,233,122 ); // numeric IP for api.pachube .com
51- char server[] = " api.pachube .com" ; // name address for pachube API
52+ IPAddress server (216 ,52 ,233 ,121 ); // numeric IP for api.cosm .com
53+ // char server[] = "api.cosm .com"; // name address for Cosm API
5254
5355unsigned long lastConnectionTime = 0 ; // last time you connected to the server, in milliseconds
5456boolean lastConnected = false ; // state of the connection last time through the main loop
55- const unsigned long postingInterval = 10 *1000 ; // delay between updates to Pachube .com
57+ const unsigned long postingInterval = 10 *1000 ; // delay between updates to Cosm .com
5658
5759void setup () {
5860 // start serial port:
@@ -76,7 +78,7 @@ void loop() {
7678 dataString += sensorReading;
7779
7880 // you can append multiple readings to this String if your
79- // pachube feed is set up to handle multiple values:
81+ // Cosm feed is set up to handle multiple values:
8082 int otherSensorReading = analogRead (A1);
8183 dataString += " \n sensor2," ;
8284 dataString += otherSensorReading;
@@ -116,8 +118,8 @@ void sendData(String thisData) {
116118 client.print (" PUT /v2/feeds/" );
117119 client.print (FEEDID);
118120 client.println (" .csv HTTP/1.1" );
119- client.println (" Host: api.pachube .com" );
120- client.print (" X-PachubeApiKey : " );
121+ client.println (" Host: api.cosm .com" );
122+ client.print (" X-CosmApiKey : " );
121123 client.println (APIKEY);
122124 client.print (" User-Agent: " );
123125 client.println (USERAGENT);
0 commit comments