info:wiznet_to_pachube_communications
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
info:wiznet_to_pachube_communications [2011/01/29 13:46] – tomgee | info:wiznet_to_pachube_communications [2011/01/29 14:35] (current) – tomgee | ||
---|---|---|---|
Line 12: | Line 12: | ||
| | ||
- | The content-length field is a count of every character in the content, which is the line at the very end. Content always comes after two newlines, at the end a HTTP PUT request, as shown above. If I was planning to send only one sensor, | + | The content-length field is a count of every character in the content, which is the line at the very end. Content always comes after two newlines, at the end of an HTTP PUT request, as shown above. If sending |
PUT /api/76.csv HTTP/1.1 | PUT /api/76.csv HTTP/1.1 | ||
Line 22: | Line 22: | ||
126 | 126 | ||
+ | ==== The Code ==== | ||
+ | |||
+ | |||
+ | Using the Arduino Ethernet shield, this kind of a call is trivial. It’s just a series of print statements: | ||
+ | |||
+ | // include the Ethernet library | ||
+ | # | ||
+ | | ||
+ | // assign a MAC address for the ethernet controller. | ||
+ | // fill in your address here: | ||
+ | byte mac[] = { | ||
+ | 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x01 }; | ||
+ | // assign an IP address for the controller: | ||
+ | byte ip[] = { | ||
+ | | ||
+ | // Assign the address of the server you want to connect to: | ||
+ | byte server[] = { | ||
+ | | ||
+ | |||
+ | // initialize the library instance: | ||
+ | | ||
+ | |||
+ | long lastConnectionTime = 0; // last time you connected to the server, in milliseconds | ||
+ | |
info/wiznet_to_pachube_communications.1296326771.txt.gz · Last modified: 2011/01/29 13:46 by tomgee