Hardware Reference
In-Depth Information
Serial.print("xivelyclient.put returned ");
Serial.println(ret);
Serial.println();
delay(15000);
}
Upload the code to your Arduino, and you'll be ready to transmit. When your
Arduino connects for the first time, the Xively server automatically adds the
feed to the web page you had open earlier.
In the code, you're creating an object that contains all the information of your
feed. This appears as an array, named datastreams[] . This contains the sensor
name and type (in this case, a float). The feed gets wrapped into a XivelyFeed
object, which has the feed ID, the datastream information, and the number of
datastreams that are in the array.
Displaying Data on the Web
Once you start running the sketch on the Arduino, data will be transmitted
immediately. Open the serial monitor to observe the status of your transmissions.
If you do not see a return status of “200” in the serial monitor, you probably
copied the wrong API key or Feed ID. Check those values and try again. Once
you know that data is being properly transmitted, return to the Xively website;
the sensor_reading data stream should now be automatically updating every
15 seconds. Click on the sensor_reading link to see a live graph of the data
coming from your photoresistor. After the graph has been running for a while,
it may look something like Figure 14-9. (The serial monitor is also shown so you
can see how they match up.) That's all there is to it. Your Arduino will continue
to communicate with and update your feed on the Xively server.
Figure 14-9: Light data being displayed on Xively
Search WWH ::




Custom Search