1414 version 0019.
1515
1616 Circuit:
17- * Ethernet shield attached to pins 10, 11, 12, 13
17+ * Ethernet shield attached to pins 10, 11, 12, 13
1818
1919 created 21 May 2011
20- updates 2 Mar 2012
2120 by Tom Igoe
2221
2322 This code is in the public domain.
3029// Enter a MAC address and IP address for your controller below.
3130// The IP address will be dependent on your local network:
3231byte mac[] = {
33- 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED };
32+ 0x00 , 0xAA , 0xBB , 0xCC , 0xDE , 0x01 };
3433IPAddress ip (192 ,168 ,1 ,20 );
3534
3635// initialize the library instance:
@@ -52,17 +51,17 @@ void setup() {
5251 currentLine.reserve (256 );
5352 tweet.reserve (150 );
5453
55- // initialize serial:
54+ // initialize serial:
5655 Serial.begin (9600 );
5756 // attempt a DHCP connection:
5857 Serial.println (" Attempting to get an IP address using DHCP:" );
5958 if (!Ethernet.begin (mac)) {
60- Serial.println (" failed to get an IP address using DHCP, trying manually" );
6159 // if DHCP fails, start with a hard-coded address:
60+ Serial.println (" failed to get an IP address using DHCP, trying manually" );
6261 Ethernet.begin (mac, ip);
6362 }
64- Serial.print (" My IP address:" );
65- Serial.println (ip );
63+ Serial.print (" My address:" );
64+ Serial.println (Ethernet. localIP () );
6665 // connect to Twitter:
6766 connectToServer ();
6867}
@@ -119,11 +118,12 @@ void connectToServer() {
119118 Serial.println (" connecting to server..." );
120119 if (client.connect (serverName, 80 )) {
121120 Serial.println (" making HTTP request..." );
122- // make HTTP GET request to twitter:
121+ // make HTTP GET request to twitter:
123122 client.println (" GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1" );
124123 client.println (" HOST: api.twitter.com" );
125124 client.println ();
126125 }
127126 // note the time of this connect attempt:
128127 lastAttemptTime = millis ();
129128}
129+
0 commit comments