User Tools

Site Tools


info:wiznet_to_pachube_communications

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
info:wiznet_to_pachube_communications [2011/01/29 13:47] tomgeeinfo:wiznet_to_pachube_communications [2011/01/29 14:35] (current) tomgee
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
 +     #include <Ethernet.h>
 +      
 +     // 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[] = {
 +       192,168,0,20 };
 +     // Assign the address of the server you want to connect to:
 +     byte server[] = {
 +       173,203,98,29 }; // pachube.com
 +     
 +     // initialize the library instance:
 +     Client client(server, 80);
 +     
 +     long lastConnectionTime = 0;      // last time you connected to the server, in milliseconds
 +     boolean lastConnected = false;    // state of the connection last time through the main loop
info/wiznet_to_pachube_communications.1296326858.txt.gz · Last modified: 2011/01/29 13:47 by tomgee