3 #include <HttpClient.h>
6 char ssid[] = "YourNetwork"; // your network SSID (name)
7 char pass[] = "password"; // your network password (use for WPA, or use as key for WEP)
8 int keyIndex = 0; // your network key Index number (needed only for WEP)
10 int status = WL_IDLE_STATUS;
12 // Your Xively key to let you upload data
13 char xivelyKey[] = "YOUR_XIVELY_API_KEY";
15 // Define the string for our datastream ID
16 char temperatureId[] = "temperature";
18 XivelyDatastream datastreams[] = {
19 XivelyDatastream(temperatureId, strlen(temperatureId), DATASTREAM_FLOAT),
21 // Finally, wrap the datastreams into a feed
22 XivelyFeed feed(15552, datastreams, 1 /* number of datastreams */);
25 XivelyClient xivelyclient(client);
27 void printWifiStatus() {
28 // print the SSID of the network you're attached to:
29 Serial.print("SSID: ");
30 Serial.println(WiFi.SSID());
32 // print your WiFi shield's IP address:
33 IPAddress ip = WiFi.localIP();
34 Serial.print("IP Address: ");
37 // print the received signal strength:
38 long rssi = WiFi.RSSI();
39 Serial.print("signal strength (RSSI):");
41 Serial.println(" dBm");
45 // put your setup code here, to run once:
48 Serial.println("Reading from Xively example");
51 // attempt to connect to Wifi network:
52 while ( status != WL_CONNECTED) {
53 Serial.print("Attempting to connect to SSID: ");
55 status = WiFi.begin(ssid, pass);
56 // wait 10 seconds for connection:
59 Serial.println("Connected to wifi");
64 int ret = xivelyclient.get(feed, xivelyKey);
65 Serial.print("xivelyclient.get returned ");
70 Serial.println("Datastream is...");
71 Serial.println(feed[0]);
73 Serial.print("Temperature is: ");
74 Serial.println(feed[0].getFloat());