Skip to content

Commit 4249d0f

Browse files
committed
removing TwitterClient since it does not include OAuth, which is now needed for Twitter logins. Adding TelnetClient examexample.
1 parent f10f008 commit 4249d0f

File tree

5 files changed

+99
-144
lines changed

5 files changed

+99
-144
lines changed

examples/PachubeClient/PachubeClient.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Ethernet shield attached to pins 10, 11, 12, 13
1212
1313
created 15 March 2010
14-
updated 25 July 2010
14+
updated 4 Sep 2010
1515
by Tom Igoe
1616
1717
http://www.tigoe.net/pcomp/code/category/arduinowiring/873
@@ -55,7 +55,7 @@ void setup() {
5555

5656
void loop() {
5757
// read the analog sensor:
58-
int sensorReading = analogRead(0);
58+
int sensorReading = analogRead(A0);
5959

6060
// if there's incoming data from the net connection.
6161
// send it out the serial port. This is for debugging

examples/PachubeClientString/PachubeClientString.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Ethernet shield attached to pins 10, 11, 12, 13
1515
1616
created 15 March 2010
17-
updated 25 July 2010
17+
updated 4 Sep 2010
1818
by Tom Igoe
1919
2020
This code is in the public domain.
@@ -57,13 +57,13 @@ void setup() {
5757

5858
void loop() {
5959
// read the analog sensor:
60-
int sensorReading = analogRead(0);
60+
int sensorReading = analogRead(A0);
6161
// convert the data to a String to send it:
6262
String dataString = String(sensorReading);
6363

6464
// you can append multiple readings to this String if your
6565
// pachube feed is set up to handle multiple values:
66-
int otherSensorReading = analogRead(1);
66+
int otherSensorReading = analogRead(A1);
6767
dataString += ",";
6868
dataString += String(otherSensorReading);
6969

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
Telnet client
3+
4+
This sketch connects to a a telnet server (http://www.google.com)
5+
using an Arduino Wiznet Ethernet shield. You'll need a telnet server
6+
to test this with.
7+
Processing's ChatServer example (part of the network library) works well,
8+
running on port 10002. It can be found as part of the examples
9+
in the Processing application, available at
10+
http://processing.org/
11+
12+
Circuit:
13+
* Ethernet shield attached to pins 10, 11, 12, 13
14+
15+
created 14 Sep 2010
16+
by Tom Igoe
17+
18+
*/
19+
20+
#include <SPI.h>
21+
#include <Ethernet.h>
22+
23+
// Enter a MAC address and IP address for your controller below.
24+
// The IP address will be dependent on your local network:
25+
byte mac[] = {
26+
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
27+
byte ip[] = {
28+
192,168,1,177 };
29+
30+
// Enter the IP address of the server you're connecting to:
31+
byte server[] = {
32+
1,1,1,1 };
33+
34+
// Initialize the Ethernet client library
35+
// with the IP address and port of the server
36+
// that you want to connect to (port 23 is default for telnet;
37+
// if you're using Processing's ChatServer, use port 10002):
38+
Client client(server, 10002);
39+
40+
void setup() {
41+
// start the Ethernet connection:
42+
Ethernet.begin(mac, ip);
43+
// start the serial library:
44+
Serial.begin(9600);
45+
// give the Ethernet shield a second to initialize:
46+
delay(1000);
47+
Serial.println("connecting...");
48+
49+
// if you get a connection, report back via serial:
50+
if (client.connect()) {
51+
Serial.println("connected");
52+
}
53+
else {
54+
// if you didn't get a connection to the server:
55+
Serial.println("connection failed");
56+
}
57+
}
58+
59+
void loop()
60+
{
61+
// if there are incoming bytes available
62+
// from the server, read them and print them:
63+
if (client.available()) {
64+
char c = client.read();
65+
Serial.print(c);
66+
}
67+
68+
// as long as there are bytes in the serial queue,
69+
// read them and send them out the socket if it's open:
70+
while (Serial.available() > 0) {
71+
char inChar = Serial.read();
72+
if (client.connected()) {
73+
client.print(inChar);
74+
}
75+
}
76+
77+
// if the server's disconnected, stop the client:
78+
if (!client.connected()) {
79+
Serial.println();
80+
Serial.println("disconnecting.");
81+
client.stop();
82+
// do nothing:
83+
while(true);
84+
}
85+
}
86+
87+
88+
89+

examples/TwitterClient/TwitterClient.pde

Lines changed: 0 additions & 136 deletions
This file was deleted.

examples/WebServer/WebServer.pde

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
1111
created 18 Dec 2009
1212
by David A. Mellis
13+
modified 4 Sep 2010
14+
by Tom Igoe
1315
1416
*/
1517

@@ -53,11 +55,11 @@ void loop()
5355
client.println();
5456

5557
// output the value of each analog input pin
56-
for (int i = 0; i < 6; i++) {
58+
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
5759
client.print("analog input ");
58-
client.print(i);
60+
client.print(analogChannel);
5961
client.print(" is ");
60-
client.print(analogRead(i));
62+
client.print(analogRead(analogChannel));
6163
client.println("<br />");
6264
}
6365
break;

0 commit comments

Comments
 (0)