1
1
/*
2
- Wifi Pachube sensor client
2
+ Wifi Cosm sensor client
3
3
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)
5
5
using an Arduino Wifi shield.
6
6
7
7
This example is written for a network using WPA encryption. For
8
8
WEP or WPA, change the Wifi.begin() call accordingly.
9
9
10
- This example has been updated to use version 2.0 of the Pachube .com API.
10
+ This example has been updated to use version 2.0 of the Cosm .com API.
11
11
To make it work, create a feed with a datastream, and give it the ID
12
12
sensor1. Or change the code below to match your feed.
13
13
16
16
* Wifi shield attached to pins 10, 11, 12, 13
17
17
18
18
created 13 Mar 2012
19
- modified 23 Apr 2012
19
+ modified 14 May 2012
20
20
by Tom Igoe
21
21
22
22
This code is in the public domain.
25
25
#include < SPI.h>
26
26
#include < WiFi.h>
27
27
28
- #define APIKEY " YOUR API KEY GOES HERE" // replace your pachube api key here
28
+ #define APIKEY " YOUR API KEY GOES HERE" // replace your cosm api key here
29
29
#define FEEDID 00000 // replace your feed ID
30
30
#define USERAGENT " My Arduino Project" // user agent is the project name
31
31
@@ -38,12 +38,12 @@ int status = WL_IDLE_STATUS;
38
38
WiFiClient client;
39
39
// if you don't want to use DNS (and reduce your sketch size)
40
40
// use the numeric IP instead of the name for the server:
41
- IPAddress server (216 ,52 ,233 ,122 ); // numeric IP for api.pachube .com
42
- // char server[] = "api.pachube .com"; // name address for pachube API
41
+ IPAddress server (216 ,52 ,233 ,121 ); // numeric IP for api.cosm .com
42
+ // char server[] = "api.cosm .com"; // name address for cosm API
43
43
44
44
unsigned long lastConnectionTime = 0 ; // last time you connected to the server, in milliseconds
45
45
boolean lastConnected = false ; // state of the connection last time through the main loop
46
- const unsigned long postingInterval = 10 *1000 ; // delay between updates to Pachube .com
46
+ const unsigned long postingInterval = 10 *1000 ; // delay between updates to Cosm .com
47
47
48
48
void setup () {
49
49
// start serial port:
@@ -101,8 +101,8 @@ void sendData(int thisData) {
101
101
client.print (" PUT /v2/feeds/" );
102
102
client.print (FEEDID);
103
103
client.println (" .csv HTTP/1.1" );
104
- client.println (" Host: api.pachube .com" );
105
- client.print (" X-PachubeApiKey : " );
104
+ client.println (" Host: api.cosm .com" );
105
+ client.print (" X-ApiKey : " );
106
106
client.println (APIKEY);
107
107
client.print (" User-Agent: " );
108
108
client.println (USERAGENT);
0 commit comments