14
14
version 0019.
15
15
16
16
Circuit:
17
- * Ethernet shield attached to pins 10, 11, 12, 13
17
+ * Ethernet shield attached to pins 10, 11, 12, 13
18
18
19
19
created 21 May 2011
20
- updates 2 Mar 2012
21
20
by Tom Igoe
22
21
23
22
This code is in the public domain.
30
29
// Enter a MAC address and IP address for your controller below.
31
30
// The IP address will be dependent on your local network:
32
31
byte mac[] = {
33
- 0xDE , 0xAD , 0xBE , 0xEF , 0xFE , 0xED };
32
+ 0x00 , 0xAA , 0xBB , 0xCC , 0xDE , 0x01 };
34
33
IPAddress ip (192 ,168 ,1 ,20 );
35
34
36
35
// initialize the library instance:
@@ -52,17 +51,17 @@ void setup() {
52
51
currentLine.reserve (256 );
53
52
tweet.reserve (150 );
54
53
55
- // initialize serial:
54
+ // initialize serial:
56
55
Serial.begin (9600 );
57
56
// attempt a DHCP connection:
58
57
Serial.println (" Attempting to get an IP address using DHCP:" );
59
58
if (!Ethernet.begin (mac)) {
60
- Serial.println (" failed to get an IP address using DHCP, trying manually" );
61
59
// if DHCP fails, start with a hard-coded address:
60
+ Serial.println (" failed to get an IP address using DHCP, trying manually" );
62
61
Ethernet.begin (mac, ip);
63
62
}
64
- Serial.print (" My IP address:" );
65
- Serial.println (ip );
63
+ Serial.print (" My address:" );
64
+ Serial.println (Ethernet. localIP () );
66
65
// connect to Twitter:
67
66
connectToServer ();
68
67
}
@@ -119,11 +118,12 @@ void connectToServer() {
119
118
Serial.println (" connecting to server..." );
120
119
if (client.connect (serverName, 80 )) {
121
120
Serial.println (" making HTTP request..." );
122
- // make HTTP GET request to twitter:
121
+ // make HTTP GET request to twitter:
123
122
client.println (" GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1" );
124
123
client.println (" HOST: api.twitter.com" );
125
124
client.println ();
126
125
}
127
126
// note the time of this connect attempt:
128
127
lastAttemptTime = millis ();
129
128
}
129
+
0 commit comments